diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index d1c65f0..076c25e 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,22 +1,23 @@ lockVersion: 2.0.0 id: 98621ff3-f200-4a5c-9c69-bc1fe845e39c management: - docChecksum: 6657dd3e876a909472f364dc1fe34d72 + docChecksum: eea382efbb6545b93db6c5b075e96409 docVersion: 0.0.0 - speakeasyVersion: 1.480.0 - generationVersion: 2.499.0 - releaseVersion: 0.7.1 - configChecksum: 283c20636f8ea078f683fa83624f7710 + speakeasyVersion: 1.523.0 + generationVersion: 2.559.0 + releaseVersion: 0.8.0 + configChecksum: 89bbc73f582f8f91edaf5b15443d1a1e repoURL: https://github.com/livepeer/livepeer-ai-go.git installationURL: https://github.com/livepeer/livepeer-ai-go features: go: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.6 - core: 3.6.11 + constsAndDefaults: 0.1.11 + core: 3.7.2 defaultEnabledRetries: 0.2.0 envVarSecurityUsage: 0.3.2 - globalSecurity: 2.82.10 + flattening: 2.81.1 + globalSecurity: 2.82.11 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.2 @@ -110,6 +111,7 @@ generatedFiles: - docs/models/operations/genimagetoimageresponse.md - docs/models/operations/genimagetotextresponse.md - docs/models/operations/genimagetovideoresponse.md + - docs/models/operations/genlivevideotovideorequest.md - docs/models/operations/genlivevideotovideoresponse.md - docs/models/operations/genllmresponse.md - docs/models/operations/gensegmentanything2response.md @@ -252,10 +254,10 @@ examples: genLiveVideoToVideo: speakeasy-default-gen-live-video-to-video: requestBody: - application/json: {"subscribe_url": "https://soulful-lava.org/", "publish_url": "https://vain-tabletop.biz", "control_url": "", "events_url": "", "model_id": ""} + application/json: {"subscribe_url": "https://soulful-lava.org/", "publish_url": "https://vain-tabletop.biz", "control_url": "", "events_url": "", "model_id": "", "gateway_request_id": "", "stream_id": ""} responses: "200": - application/json: {"subscribe_url": "https://vain-kiss.name", "publish_url": "https://frail-duffel.com", "control_url": "", "events_url": ""} + application/json: {"subscribe_url": "https://vain-kiss.name", "publish_url": "https://frail-duffel.com", "control_url": "", "events_url": "", "request_id": ""} "400": application/json: {"detail": {"msg": ""}} "422": diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0a67405..7716e8b 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -7,13 +7,15 @@ generation: useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true + nameResolutionFeb2025: false parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true + securityFeb2025: false auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false go: - version: 0.7.1 + version: 0.8.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e5e61f6..1d35b64 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,12 +1,12 @@ -speakeasyVersion: 1.480.0 +speakeasyVersion: 1.523.0 sources: livepeerai-OAS: sourceNamespace: livepeerai-oas - sourceRevisionDigest: sha256:17df08f6003f51fd012286a1a4579ddd9ce9a377318644fc1c8bc9059fc6bd91 - sourceBlobDigest: sha256:7c0df39c1c5f0ffe580b63f5dc6cb0f81181f5361a80f63f41314cf81d0f3bf4 + sourceRevisionDigest: sha256:db11bae82d18f169474fd35f84058fd0de96ea62c356783caf2d195de47f6214 + sourceBlobDigest: sha256:716236ed88f636664c3f92c8c6a24f2d2cc4fcf03862fc83398c322f3323aea0 tags: - latest - - speakeasy-sdk-regen-1736900777 + - speakeasy-sdk-regen-1739406403 - 0.0.0 targets: livepeerai: @@ -17,10 +17,10 @@ targets: livepeerai-go: source: livepeerai-OAS sourceNamespace: livepeerai-oas - sourceRevisionDigest: sha256:17df08f6003f51fd012286a1a4579ddd9ce9a377318644fc1c8bc9059fc6bd91 - sourceBlobDigest: sha256:7c0df39c1c5f0ffe580b63f5dc6cb0f81181f5361a80f63f41314cf81d0f3bf4 + sourceRevisionDigest: sha256:db11bae82d18f169474fd35f84058fd0de96ea62c356783caf2d195de47f6214 + sourceBlobDigest: sha256:716236ed88f636664c3f92c8c6a24f2d2cc4fcf03862fc83398c322f3323aea0 codeSamplesNamespace: code-samples-go-livepeerai-go - codeSamplesRevisionDigest: sha256:d919c3d9ec0aa7e1faf0cbc60f807b5ae75ce44626762362e3b8f1bf29488b54 + codeSamplesRevisionDigest: sha256:17326e47dc90c191f5d296cdf4c8061bd8d67feb1e9e15883658badd57011401 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 3b598e9..9e96257 100644 --- a/README.md +++ b/README.md @@ -31,16 +31,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }, operations.WithRetries( retry.Config{ Strategy: "backoff", @@ -93,16 +84,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { log.Fatal(err) @@ -153,16 +135,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { @@ -202,10 +175,10 @@ func main() { You can override the default server globally using the `WithServerIndex(serverIndex int)` option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: -| # | Server | -| --- | ------------------------------------------- | -| 0 | `https://dream-gateway.livepeer.cloud` | -| 1 | `https://livepeer.studio/api/beta/generate` | +| # | Server | Description | +| --- | ------------------------------------------- | -------------------------------- | +| 0 | `https://dream-gateway.livepeer.cloud` | Livepeer Cloud Community Gateway | +| 1 | `https://livepeer.studio/api/beta/generate` | Livepeer Studio Gateway | #### Example @@ -228,16 +201,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { log.Fatal(err) @@ -271,16 +235,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { log.Fatal(err) @@ -352,16 +307,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { log.Fatal(err) diff --git a/RELEASES.md b/RELEASES.md index 0cc3d05..4c60ea6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -128,4 +128,14 @@ Based on: ### Generated - [go v0.7.1] . ### Releases -- [Go v0.7.1] https://github.com/livepeer/livepeer-ai-go/releases/tag/v0.7.1 - . \ No newline at end of file +- [Go v0.7.1] https://github.com/livepeer/livepeer-ai-go/releases/tag/v0.7.1 - . + +## 2025-03-23 00:30:34 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.523.0 (2.559.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.8.0] . +### Releases +- [Go v0.8.0] https://github.com/livepeer/livepeer-ai-go/releases/tag/v0.8.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 3b7baa0..d249705 100644 --- a/USAGE.md +++ b/USAGE.md @@ -17,16 +17,7 @@ func main() { ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), + Prompt: "", }) if err != nil { log.Fatal(err) diff --git a/codeSamples.yaml b/codeSamples.yaml index f994156..fc77c2b 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -8,58 +8,381 @@ actions: 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(\"\"),\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 ModelID: livepeeraigo.String(\"\"),\n ReturnTimestamps: livepeeraigo.String(\"true\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.TextResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.AudioToText(ctx, components.BodyGenAudioToText{ + Audio: components.Audio{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.TextResponse != nil { + // handle response + } + } - 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(\"\"),\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: \"\",\n Image: components.Image{\n FileName: \"example.file\",\n Content: content,\n },\n ModelID: livepeeraigo.String(\"\"),\n Loras: livepeeraigo.String(\"\"),\n Strength: livepeeraigo.Float64(0.8),\n GuidanceScale: livepeeraigo.Float64(7.5),\n ImageGuidanceScale: livepeeraigo.Float64(1.5),\n NegativePrompt: livepeeraigo.String(\"\"),\n SafetyCheck: livepeeraigo.Bool(true),\n NumInferenceSteps: livepeeraigo.Int64(100),\n NumImagesPerPrompt: livepeeraigo.Int64(1),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.ImageToImage(ctx, components.BodyGenImageToImage{ + Prompt: "", + Image: components.Image{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ImageResponse != nil { + // handle response + } + } - 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(\"\"),\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 Prompt: livepeeraigo.String(\"\"),\n ModelID: livepeeraigo.String(\"\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageToTextResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.ImageToText(ctx, components.BodyGenImageToText{ + Image: components.BodyGenImageToTextImage{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ImageToTextResponse != nil { + // handle response + } + } - 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(\"\"),\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 ModelID: livepeeraigo.String(\"\"),\n Height: livepeeraigo.Int64(576),\n Width: livepeeraigo.Int64(1024),\n Fps: livepeeraigo.Int64(6),\n MotionBucketID: livepeeraigo.Int64(127),\n NoiseAugStrength: livepeeraigo.Float64(0.02),\n SafetyCheck: livepeeraigo.Bool(true),\n NumInferenceSteps: livepeeraigo.Int64(25),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.VideoResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.ImageToVideo(ctx, components.BodyGenImageToVideo{ + Image: components.BodyGenImageToVideoImage{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.VideoResponse != nil { + // handle response + } + } - 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(\"\"),\n )\n\n res, err := s.Generate.LiveVideoToVideo(ctx, components.LiveVideoToVideoParams{\n SubscribeURL: \"https://soulful-lava.org/\",\n PublishURL: \"https://vain-tabletop.biz\",\n ControlURL: livepeeraigo.String(\"\"),\n EventsURL: livepeeraigo.String(\"\"),\n ModelID: livepeeraigo.String(\"\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LiveVideoToVideoResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + res, err := s.Generate.LiveVideoToVideo(ctx, components.LiveVideoToVideoParams{ + SubscribeURL: "https://soulful-lava.org/", + PublishURL: "https://vain-tabletop.biz", + }, nil, nil) + if err != nil { + log.Fatal(err) + } + if res.LiveVideoToVideoResponse != nil { + // handle response + } + } - 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(\"\"),\n )\n\n res, err := s.Generate.Llm(ctx, components.LLMRequest{\n Messages: []components.LLMMessage{\n\n },\n Model: livepeeraigo.String(\"\"),\n Temperature: livepeeraigo.Float64(0.7),\n MaxTokens: livepeeraigo.Int64(256),\n TopP: livepeeraigo.Float64(1),\n TopK: livepeeraigo.Int64(-1),\n Stream: livepeeraigo.Bool(false),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.LLMResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + res, err := s.Generate.Llm(ctx, components.LLMRequest{ + Messages: []components.LLMMessage{ + + }, + }) + if err != nil { + log.Fatal(err) + } + if res.LLMResponse != nil { + // handle response + } + } - 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(\"\"),\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 ModelID: livepeeraigo.String(\"\"),\n MultimaskOutput: livepeeraigo.Bool(true),\n ReturnLogits: livepeeraigo.Bool(true),\n NormalizeCoords: livepeeraigo.Bool(true),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.MasksResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.SegmentAnything2(ctx, components.BodyGenSegmentAnything2{ + Image: components.BodyGenSegmentAnything2Image{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.MasksResponse != nil { + // handle response + } + } - 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(\"\"),\n )\n\n res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{\n ModelID: livepeeraigo.String(\"\"),\n Loras: livepeeraigo.String(\"\"),\n Prompt: \"\",\n Height: livepeeraigo.Int64(576),\n Width: livepeeraigo.Int64(1024),\n GuidanceScale: livepeeraigo.Float64(7.5),\n NegativePrompt: livepeeraigo.String(\"\"),\n SafetyCheck: livepeeraigo.Bool(true),\n NumInferenceSteps: livepeeraigo.Int64(50),\n NumImagesPerPrompt: livepeeraigo.Int64(1),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ + Prompt: "", + }) + if err != nil { + log.Fatal(err) + } + if res.ImageResponse != nil { + // handle response + } + } - 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(\"\"),\n )\n\n res, err := s.Generate.TextToSpeech(ctx, components.TextToSpeechParams{\n ModelID: livepeeraigo.String(\"\"),\n Text: livepeeraigo.String(\"\"),\n Description: livepeeraigo.String(\"A male speaker delivers a slightly expressive and animated speech with a moderate speed and pitch.\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AudioResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + res, err := s.Generate.TextToSpeech(ctx, components.TextToSpeechParams{}) + if err != nil { + log.Fatal(err) + } + if res.AudioResponse != nil { + // handle response + } + } - 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(\"\"),\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: \"\",\n Image: components.BodyGenUpscaleImage{\n FileName: \"example.file\",\n Content: content,\n },\n ModelID: livepeeraigo.String(\"\"),\n SafetyCheck: livepeeraigo.Bool(true),\n NumInferenceSteps: livepeeraigo.Int64(75),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ImageResponse != nil {\n // handle response\n }\n}" + source: |- + package main + + import( + "context" + livepeeraigo "github.com/livepeer/livepeer-ai-go" + "os" + "github.com/livepeer/livepeer-ai-go/models/components" + "log" + ) + + func main() { + ctx := context.Background() + + s := livepeeraigo.New( + livepeeraigo.WithSecurity(""), + ) + + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + + res, err := s.Generate.Upscale(ctx, components.BodyGenUpscale{ + Prompt: "", + Image: components.BodyGenUpscaleImage{ + FileName: "example.file", + Content: content, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ImageResponse != nil { + // handle response + } + } diff --git a/docs/models/components/livevideotovideoparams.md b/docs/models/components/livevideotovideoparams.md index 67b5b70..e39503e 100644 --- a/docs/models/components/livevideotovideoparams.md +++ b/docs/models/components/livevideotovideoparams.md @@ -10,4 +10,6 @@ | `ControlURL` | **string* | :heavy_minus_sign: | URL for subscribing via Trickle protocol for updates in the live video-to-video generation params. | | `EventsURL` | **string* | :heavy_minus_sign: | URL for publishing events via Trickle protocol for pipeline status and logs. | | `ModelID` | **string* | :heavy_minus_sign: | Name of the pipeline to run in the live video to video job. Notice that this is named model_id for consistency with other routes, but it does not refer to a Hugging Face model ID. The exact model(s) depends on the pipeline implementation and might be configurable via the `params` argument. | -| `Params` | [*components.Params](../../models/components/params.md) | :heavy_minus_sign: | Initial parameters for the pipeline. | \ No newline at end of file +| `Params` | [*components.Params](../../models/components/params.md) | :heavy_minus_sign: | Initial parameters for the pipeline. | +| `GatewayRequestID` | **string* | :heavy_minus_sign: | The ID of the Gateway request (for logging purposes). | +| `StreamID` | **string* | :heavy_minus_sign: | The Stream ID (for logging purposes). | \ No newline at end of file diff --git a/docs/models/components/livevideotovideoresponse.md b/docs/models/components/livevideotovideoresponse.md index 4264b72..60a1d36 100644 --- a/docs/models/components/livevideotovideoresponse.md +++ b/docs/models/components/livevideotovideoresponse.md @@ -10,4 +10,5 @@ Response model for live video-to-video generation. | `SubscribeURL` | *string* | :heavy_check_mark: | Source URL of the incoming stream to subscribe to | | `PublishURL` | *string* | :heavy_check_mark: | Destination URL of the outgoing stream to publish to | | `ControlURL` | **string* | :heavy_minus_sign: | URL for updating the live video-to-video generation | -| `EventsURL` | **string* | :heavy_minus_sign: | URL for subscribing to events for pipeline status and logs | \ No newline at end of file +| `EventsURL` | **string* | :heavy_minus_sign: | URL for subscribing to events for pipeline status and logs | +| `RequestID` | **string* | :heavy_minus_sign: | The ID generated for this request | \ No newline at end of file diff --git a/docs/models/operations/genlivevideotovideorequest.md b/docs/models/operations/genlivevideotovideorequest.md new file mode 100644 index 0000000..eb27fb0 --- /dev/null +++ b/docs/models/operations/genlivevideotovideorequest.md @@ -0,0 +1,10 @@ +# GenLiveVideoToVideoRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `RequestID` | **string* | :heavy_minus_sign: | N/A | +| `StreamID` | **string* | :heavy_minus_sign: | N/A | +| `LiveVideoToVideoParams` | [components.LiveVideoToVideoParams](../../models/components/livevideotovideoparams.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/generate/README.md b/docs/sdks/generate/README.md index f3d64f0..5206c17 100644 --- a/docs/sdks/generate/README.md +++ b/docs/sdks/generate/README.md @@ -34,22 +34,13 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) res, err := s.Generate.TextToImage(ctx, components.TextToImageParams{ - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), Prompt: "", - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - GuidanceScale: livepeeraigo.Float64(7.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(50), - NumImagesPerPrompt: livepeeraigo.Int64(1), }) if err != nil { log.Fatal(err) @@ -100,7 +91,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -117,15 +108,6 @@ func main() { FileName: "example.file", Content: content, }, - ModelID: livepeeraigo.String(""), - Loras: livepeeraigo.String(""), - Strength: livepeeraigo.Float64(0.8), - GuidanceScale: livepeeraigo.Float64(7.5), - ImageGuidanceScale: livepeeraigo.Float64(1.5), - NegativePrompt: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(100), - NumImagesPerPrompt: livepeeraigo.Int64(1), }) if err != nil { log.Fatal(err) @@ -176,7 +158,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -192,14 +174,6 @@ func main() { FileName: "example.file", Content: content, }, - ModelID: livepeeraigo.String(""), - Height: livepeeraigo.Int64(576), - Width: livepeeraigo.Int64(1024), - Fps: livepeeraigo.Int64(6), - MotionBucketID: livepeeraigo.Int64(127), - NoiseAugStrength: livepeeraigo.Float64(0.02), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(25), }) if err != nil { log.Fatal(err) @@ -250,7 +224,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -267,9 +241,6 @@ func main() { FileName: "example.file", Content: content, }, - ModelID: livepeeraigo.String(""), - SafetyCheck: livepeeraigo.Bool(true), - NumInferenceSteps: livepeeraigo.Int64(75), }) if err != nil { log.Fatal(err) @@ -320,7 +291,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -336,8 +307,6 @@ func main() { FileName: "example.file", Content: content, }, - ModelID: livepeeraigo.String(""), - ReturnTimestamps: livepeeraigo.String("true"), }) if err != nil { log.Fatal(err) @@ -388,7 +357,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -404,10 +373,6 @@ func main() { FileName: "example.file", Content: content, }, - ModelID: livepeeraigo.String(""), - MultimaskOutput: livepeeraigo.Bool(true), - ReturnLogits: livepeeraigo.Bool(true), - NormalizeCoords: livepeeraigo.Bool(true), }) if err != nil { log.Fatal(err) @@ -457,7 +422,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -466,12 +431,6 @@ func main() { Messages: []components.LLMMessage{ }, - Model: livepeeraigo.String(""), - Temperature: livepeeraigo.Float64(0.7), - MaxTokens: livepeeraigo.Int64(256), - TopP: livepeeraigo.Float64(1), - TopK: livepeeraigo.Int64(-1), - Stream: livepeeraigo.Bool(false), }) if err != nil { log.Fatal(err) @@ -522,7 +481,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -538,8 +497,6 @@ func main() { FileName: "example.file", Content: content, }, - Prompt: livepeeraigo.String(""), - ModelID: livepeeraigo.String(""), }) if err != nil { log.Fatal(err) @@ -589,7 +546,7 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) @@ -597,10 +554,7 @@ func main() { res, err := s.Generate.LiveVideoToVideo(ctx, components.LiveVideoToVideoParams{ SubscribeURL: "https://soulful-lava.org/", PublishURL: "https://vain-tabletop.biz", - ControlURL: livepeeraigo.String(""), - EventsURL: livepeeraigo.String(""), - ModelID: livepeeraigo.String(""), - }) + }, nil, nil) if err != nil { log.Fatal(err) } @@ -615,7 +569,9 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [components.LiveVideoToVideoParams](../../models/components/livevideotovideoparams.md) | :heavy_check_mark: | The request object to use for the request. | +| `liveVideoToVideoParams` | [components.LiveVideoToVideoParams](../../models/components/livevideotovideoparams.md) | :heavy_check_mark: | N/A | +| `requestID` | **string* | :heavy_minus_sign: | N/A | +| `streamID` | **string* | :heavy_minus_sign: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -649,16 +605,12 @@ import( func main() { ctx := context.Background() - + s := livepeeraigo.New( livepeeraigo.WithSecurity(""), ) - res, err := s.Generate.TextToSpeech(ctx, components.TextToSpeechParams{ - ModelID: livepeeraigo.String(""), - Text: livepeeraigo.String(""), - Description: livepeeraigo.String("A male speaker delivers a slightly expressive and animated speech with a moderate speed and pitch."), - }) + res, err := s.Generate.TextToSpeech(ctx, components.TextToSpeechParams{}) if err != nil { log.Fatal(err) } diff --git a/generate.go b/generate.go index 26596a5..190f127 100644 --- a/generate.go +++ b/generate.go @@ -29,13 +29,6 @@ func newGenerate(sdkConfig sdkConfiguration) *Generate { // TextToImage - Text To Image // Generate images from text prompts. func (s *Generate) TextToImage(ctx context.Context, request components.TextToImageParams, opts ...operations.Option) (*operations.GenTextToImageResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genTextToImage", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -59,6 +52,13 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genTextToImage", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err @@ -303,13 +303,6 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma // ImageToImage - Image To Image // Apply image transformations to a provided image. func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenImageToImage, opts ...operations.Option) (*operations.GenImageToImageResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genImageToImage", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -333,6 +326,13 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genImageToImage", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -577,13 +577,6 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI // ImageToVideo - Image To Video // Generate a video from a provided image. func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenImageToVideo, opts ...operations.Option) (*operations.GenImageToVideoResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genImageToVideo", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -607,6 +600,13 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genImageToVideo", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -851,13 +851,6 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI // Upscale // Upscale an image by increasing its resolution. func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscale, opts ...operations.Option) (*operations.GenUpscaleResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genUpscale", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -881,6 +874,13 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genUpscale", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -1125,13 +1125,6 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal // AudioToText - Audio To Text // Transcribe audio files to text. func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAudioToText, opts ...operations.Option) (*operations.GenAudioToTextResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genAudioToText", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1155,6 +1148,13 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genAudioToText", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -1403,13 +1403,6 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu // SegmentAnything2 - Segment Anything 2 // Segment objects in an image. func (s *Generate) SegmentAnything2(ctx context.Context, request components.BodyGenSegmentAnything2, opts ...operations.Option) (*operations.GenSegmentAnything2Response, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genSegmentAnything2", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1433,6 +1426,13 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genSegmentAnything2", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -1677,13 +1677,6 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body // Llm - LLM // Generate text using a language model. func (s *Generate) Llm(ctx context.Context, request components.LLMRequest, opts ...operations.Option) (*operations.GenLLMResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genLLM", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1707,6 +1700,13 @@ func (s *Generate) Llm(ctx context.Context, request components.LLMRequest, opts return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genLLM", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err @@ -1951,13 +1951,6 @@ func (s *Generate) Llm(ctx context.Context, request components.LLMRequest, opts // ImageToText - Image To Text // Transform image files to text. func (s *Generate) ImageToText(ctx context.Context, request components.BodyGenImageToText, opts ...operations.Option) (*operations.GenImageToTextResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genImageToText", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1981,6 +1974,13 @@ func (s *Generate) ImageToText(ctx context.Context, request components.BodyGenIm return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genImageToText", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "multipart", `request:"mediaType=multipart/form-data"`) if err != nil { return nil, err @@ -2226,12 +2226,11 @@ func (s *Generate) ImageToText(ctx context.Context, request components.BodyGenIm // LiveVideoToVideo - Live Video To Video // Apply transformations to a live video streamed to the returned endpoints. -func (s *Generate) LiveVideoToVideo(ctx context.Context, request components.LiveVideoToVideoParams, opts ...operations.Option) (*operations.GenLiveVideoToVideoResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genLiveVideoToVideo", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, +func (s *Generate) LiveVideoToVideo(ctx context.Context, liveVideoToVideoParams components.LiveVideoToVideoParams, requestID *string, streamID *string, opts ...operations.Option) (*operations.GenLiveVideoToVideoResponse, error) { + request := operations.GenLiveVideoToVideoRequest{ + RequestID: requestID, + StreamID: streamID, + LiveVideoToVideoParams: liveVideoToVideoParams, } o := operations.Options{} @@ -2257,7 +2256,14 @@ func (s *Generate) LiveVideoToVideo(ctx context.Context, request components.Live return nil, fmt.Errorf("error generating URL: %w", err) } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genLiveVideoToVideo", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "LiveVideoToVideoParams", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -2283,6 +2289,8 @@ func (s *Generate) LiveVideoToVideo(ctx context.Context, request components.Live req.Header.Set("Content-Type", reqContentType) } + utils.PopulateHeaders(ctx, req, request, nil) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -2501,13 +2509,6 @@ func (s *Generate) LiveVideoToVideo(ctx context.Context, request components.Live // TextToSpeech - Text To Speech // Generate a text-to-speech audio file based on the provided text input and speaker description. func (s *Generate) TextToSpeech(ctx context.Context, request components.TextToSpeechParams, opts ...operations.Option) (*operations.GenTextToSpeechResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "genTextToSpeech", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -2531,6 +2532,13 @@ func (s *Generate) TextToSpeech(ctx context.Context, request components.TextToSp return nil, fmt.Errorf("error generating URL: %w", err) } + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "genTextToSpeech", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err diff --git a/internal/hooks/hooks.go b/internal/hooks/hooks.go index 8ea491a..a0b49da 100644 --- a/internal/hooks/hooks.go +++ b/internal/hooks/hooks.go @@ -24,6 +24,7 @@ type HTTPClient interface { } type HookContext struct { + BaseURL string Context context.Context OperationID string OAuth2Scopes []string diff --git a/internal/utils/form.go b/internal/utils/form.go index 9e33358..7274643 100644 --- a/internal/utils/form.go +++ b/internal/utils/form.go @@ -15,11 +15,15 @@ import ( "github.com/livepeer/livepeer-ai-go/types" ) -func populateForm(paramName string, explode bool, objType reflect.Type, objValue reflect.Value, delimiter string, getFieldName func(reflect.StructField) string) url.Values { +func populateForm(paramName string, explode bool, objType reflect.Type, objValue reflect.Value, delimiter string, defaultValue *string, getFieldName func(reflect.StructField) string) url.Values { formValues := url.Values{} if isNil(objType, objValue) { + if defaultValue != nil { + formValues.Add(paramName, *defaultValue) + } + return formValues } diff --git a/internal/utils/queryparams.go b/internal/utils/queryparams.go index 0039cea..f22af48 100644 --- a/internal/utils/queryparams.go +++ b/internal/utils/queryparams.go @@ -65,6 +65,14 @@ func populateQueryParams(queryParams interface{}, globals interface{}, values ur continue } + constValue := parseConstTag(fieldType) + if constValue != nil { + values.Add(qpTag.ParamName, *constValue) + continue + } + + defaultValue := parseDefaultTag(fieldType) + if globals != nil { var globalFound bool fieldType, valType, globalFound = populateFromGlobals(fieldType, valType, queryParamTagKey, globals) @@ -91,14 +99,14 @@ func populateQueryParams(queryParams interface{}, globals interface{}, values ur } } case "form": - vals := populateFormParams(qpTag, fieldType.Type, valType, ",") + vals := populateFormParams(qpTag, fieldType.Type, valType, ",", defaultValue) for k, v := range vals { for _, vv := range v { values.Add(k, vv) } } case "pipeDelimited": - vals := populateFormParams(qpTag, fieldType.Type, valType, "|") + vals := populateFormParams(qpTag, fieldType.Type, valType, "|", defaultValue) for k, v := range vals { for _, vv := range v { values.Add(k, vv) @@ -240,8 +248,8 @@ func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, stru } } -func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { - return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { +func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string, defaultValue *string) url.Values { + return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, defaultValue, func(fieldType reflect.StructField) string { qpTag := parseQueryParamTag(fieldType) if qpTag == nil { return "" diff --git a/internal/utils/requestbody.go b/internal/utils/requestbody.go index 78479c6..8fe01ad 100644 --- a/internal/utils/requestbody.go +++ b/internal/utils/requestbody.go @@ -292,7 +292,7 @@ func encodeFormData(fieldName string, w io.Writer, data interface{}) error { switch tag.Style { // TODO: support other styles case "form": - values := populateForm(tag.Name, tag.Explode, fieldType, valType, ",", func(sf reflect.StructField) string { + values := populateForm(tag.Name, tag.Explode, fieldType, valType, ",", nil, func(sf reflect.StructField) string { tag := parseFormTag(field) if tag == nil { return "" diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 031a71a..6f1f538 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -96,6 +96,26 @@ func AsSecuritySource(security interface{}) func(context.Context) (interface{}, } } +func parseConstTag(field reflect.StructField) *string { + value := field.Tag.Get("const") + + if value == "" { + return nil + } + + return &value +} + +func parseDefaultTag(field reflect.StructField) *string { + value := field.Tag.Get("default") + + if value == "" { + return nil + } + + return &value +} + func parseStructTag(tagKey string, field reflect.StructField) map[string]string { tag := field.Tag.Get(tagKey) if tag == "" { diff --git a/livepeer.go b/livepeer.go index 8f4e56f..9fa44a1 100644 --- a/livepeer.go +++ b/livepeer.go @@ -151,9 +151,9 @@ func New(opts ...SDKOption) *Livepeer { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.0", - SDKVersion: "0.7.1", - GenVersion: "2.499.0", - UserAgent: "speakeasy-sdk/go 0.7.1 2.499.0 0.0.0 github.com/livepeer/livepeer-ai-go", + SDKVersion: "0.8.0", + GenVersion: "2.559.0", + UserAgent: "speakeasy-sdk/go 0.8.0 2.559.0 0.0.0 github.com/livepeer/livepeer-ai-go", Hooks: hooks.New(), }, } diff --git a/models/components/livevideotovideoparams.go b/models/components/livevideotovideoparams.go index 2d65a8e..bdf65ce 100644 --- a/models/components/livevideotovideoparams.go +++ b/models/components/livevideotovideoparams.go @@ -23,6 +23,10 @@ type LiveVideoToVideoParams struct { ModelID *string `default:"" json:"model_id"` // Initial parameters for the pipeline. Params *Params `json:"params,omitempty"` + // The ID of the Gateway request (for logging purposes). + GatewayRequestID *string `default:"" json:"gateway_request_id"` + // The Stream ID (for logging purposes). + StreamID *string `default:"" json:"stream_id"` } func (l LiveVideoToVideoParams) MarshalJSON() ([]byte, error) { @@ -77,3 +81,17 @@ func (o *LiveVideoToVideoParams) GetParams() *Params { } return o.Params } + +func (o *LiveVideoToVideoParams) GetGatewayRequestID() *string { + if o == nil { + return nil + } + return o.GatewayRequestID +} + +func (o *LiveVideoToVideoParams) GetStreamID() *string { + if o == nil { + return nil + } + return o.StreamID +} diff --git a/models/components/livevideotovideoresponse.go b/models/components/livevideotovideoresponse.go index bda30d5..a4344d8 100644 --- a/models/components/livevideotovideoresponse.go +++ b/models/components/livevideotovideoresponse.go @@ -16,6 +16,8 @@ type LiveVideoToVideoResponse struct { ControlURL *string `default:"" json:"control_url"` // URL for subscribing to events for pipeline status and logs EventsURL *string `default:"" json:"events_url"` + // The ID generated for this request + RequestID *string `default:"" json:"request_id"` } func (l LiveVideoToVideoResponse) MarshalJSON() ([]byte, error) { @@ -56,3 +58,10 @@ func (o *LiveVideoToVideoResponse) GetEventsURL() *string { } return o.EventsURL } + +func (o *LiveVideoToVideoResponse) GetRequestID() *string { + if o == nil { + return nil + } + return o.RequestID +} diff --git a/models/operations/genlivevideotovideo.go b/models/operations/genlivevideotovideo.go index 6bb8204..ab0e0b2 100644 --- a/models/operations/genlivevideotovideo.go +++ b/models/operations/genlivevideotovideo.go @@ -6,6 +6,33 @@ import ( "github.com/livepeer/livepeer-ai-go/models/components" ) +type GenLiveVideoToVideoRequest struct { + RequestID *string `header:"style=simple,explode=false,name=requestID"` + StreamID *string `header:"style=simple,explode=false,name=streamID"` + LiveVideoToVideoParams components.LiveVideoToVideoParams `request:"mediaType=application/json"` +} + +func (o *GenLiveVideoToVideoRequest) GetRequestID() *string { + if o == nil { + return nil + } + return o.RequestID +} + +func (o *GenLiveVideoToVideoRequest) GetStreamID() *string { + if o == nil { + return nil + } + return o.StreamID +} + +func (o *GenLiveVideoToVideoRequest) GetLiveVideoToVideoParams() components.LiveVideoToVideoParams { + if o == nil { + return components.LiveVideoToVideoParams{} + } + return o.LiveVideoToVideoParams +} + type GenLiveVideoToVideoResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Successful Response