-
Notifications
You must be signed in to change notification settings - Fork 0
/
codeSamples.yaml
65 lines (65 loc) · 8.52 KB
/
codeSamples.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
overlay: 1.0.0
info:
title: CodeSamples overlay for go target
version: 0.0.0
actions:
- target: $["paths"]["/audio-to-text"]["post"]
update:
x-codeSamples:
- lang: go
label: genAudioToText
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.AudioToText(ctx, components.BodyGenAudioToText{\n Audio: components.Audio{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.TextResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/image-to-image"]["post"]
update:
x-codeSamples:
- lang: go
label: genImageToImage
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.ImageToImage(ctx, components.BodyGenImageToImage{\n Prompt: \"<value>\",\n Image: components.Image{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/image-to-text"]["post"]
update:
x-codeSamples:
- lang: go
label: genImageToText
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.ImageToText(ctx, components.BodyGenImageToText{\n Image: components.BodyGenImageToTextImage{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageToTextResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/image-to-video"]["post"]
update:
x-codeSamples:
- lang: go
label: genImageToVideo
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.ImageToVideo(ctx, components.BodyGenImageToVideo{\n Image: components.BodyGenImageToVideoImage{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.VideoResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/live-video-to-video"]["post"]
update:
x-codeSamples:
- lang: go
label: genLiveVideoToVideo
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n res, err := s.Generate.LiveVideoToVideo(ctx, components.LiveVideoToVideoParams{\n SubscribeURL: \"https://soulful-lava.org/\",\n PublishURL: \"https://vain-tabletop.biz\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LiveVideoToVideoResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/llm"]["post"]
update:
x-codeSamples:
- lang: go
label: genLLM
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n res, err := s.Generate.Llm(ctx, components.BodyGenLLM{\n Prompt: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LLMResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/segment-anything-2"]["post"]
update:
x-codeSamples:
- lang: go
label: genSegmentAnything2
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.SegmentAnything2(ctx, components.BodyGenSegmentAnything2{\n Image: components.BodyGenSegmentAnything2Image{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MasksResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/text-to-image"]["post"]
update:
x-codeSamples:
- lang: go
label: genTextToImage
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{\n Prompt: \"<value>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/text-to-speech"]["post"]
update:
x-codeSamples:
- lang: go
label: genTextToSpeech
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n res, err := s.Generate.TextToSpeech(ctx, components.TextToSpeechParams{})\n if err != nil {\n log.Fatal(err)\n }\n if res.AudioResponse != nil {\n // handle response\n }\n}"
- target: $["paths"]["/upscale"]["post"]
update:
x-codeSamples:
- lang: go
label: genUpscale
source: "package main\n\nimport(\n\t\"context\"\n\tlivepeeraigo \"github.com/livepeer/livepeer-ai-go\"\n\t\"os\"\n\t\"github.com/livepeer/livepeer-ai-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := livepeeraigo.New(\n livepeeraigo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.Generate.Upscale(ctx, components.BodyGenUpscale{\n Prompt: \"<value>\",\n Image: components.BodyGenUpscaleImage{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}"