From 69b1d770c4ce2ce812148979000e6fd501c3839a Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Mon, 26 Aug 2024 15:21:52 +0200 Subject: [PATCH] chore: update OpenAPI spec filetype This commit ensures that the SDKs are generated using the new yaml OpenAPI spec instead of the Json one. It also fixes a small issue with the python configuration which caused parts of the docs to show as UNSET. --- .devcontainer/README.md | 9 ++++++-- .devcontainer/setup.sh | 2 +- .speakeasy/gen.lock | 10 ++++----- .speakeasy/gen.yaml | 4 ++-- .speakeasy/workflow.lock | 17 +++++++------- .speakeasy/workflow.yaml | 2 +- README.md | 4 ++-- codeSamples.yaml | 12 +++++----- docs/models/apierror.md | 4 +++- docs/models/chunk.md | 10 +++++---- docs/models/httperror.md | 4 ++-- docs/models/imageresponse.md | 4 +++- docs/models/media.md | 12 +++++----- docs/models/textresponse.md | 6 +++-- docs/models/videoresponse.md | 4 +++- docs/sdks/livepeerai/README.md | 10 ++++----- pyproject.toml | 3 ++- scripts/prepare-readme.py | 30 ++++++++++++++++++++++--- src/livepeer_ai/_hooks/__init__.py | 1 + src/livepeer_ai/_hooks/registration.py | 13 +++++++++++ src/livepeer_ai/_hooks/sdkhooks.py | 2 ++ src/livepeer_ai/models/apierror.py | 6 +++++ src/livepeer_ai/models/chunk.py | 8 +++++++ src/livepeer_ai/models/httperror.py | 3 ++- src/livepeer_ai/models/imageresponse.py | 6 +++++ src/livepeer_ai/models/media.py | 10 +++++++++ src/livepeer_ai/models/textresponse.py | 8 +++++++ src/livepeer_ai/models/videoresponse.py | 6 +++++ src/livepeer_ai/sdk.py | 20 +++++++++++++++++ src/livepeer_ai/sdkconfiguration.py | 6 ++--- 30 files changed, 179 insertions(+), 57 deletions(-) create mode 100644 src/livepeer_ai/_hooks/registration.py diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 9e0277c..997fed6 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,4 +1,9 @@ +
+ +
+
+ > **Remember to shutdown a GitHub Codespace when it is not in use!** # Dev Containers Quick Start @@ -20,11 +25,11 @@ The speakeasy CLI allows you to generate more usage snippets. Here's how: - To generate a sample for a specific operation by providing an operation ID, use: ``` -speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json -l python -i {INPUT_OPERATION_ID} -o ./samples +speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples ``` - To generate samples for an entire namespace (like a tag or group name), use: ``` -speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json -l python -n {INPUT_TAG_NAME} -o ./samples +speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml -l python -n {INPUT_TAG_NAME} -o ./samples ``` diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 00f308d..c9a4c84 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -11,4 +11,4 @@ python -m pip install --upgrade pip pip install -e . # Generate starter usage sample with speakeasy -speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json -l python -o samples/root.py \ No newline at end of file +speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml -l python -o samples/root.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f20f2b5..2e728a1 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 2d5dbf5a-62be-411a-9c7b-bc7b6dc79e13 management: - docChecksum: c222ffbf28e5f62770dc8cbd99010f96 + docChecksum: cd6c43d2e31a6a23e22275e50c38d52e docVersion: v0.1.2 - speakeasyVersion: 1.377.0 - generationVersion: 2.404.0 - releaseVersion: 0.1.4 - configChecksum: a4b1b6e1d971710b6648986f1a937812 + speakeasyVersion: 1.379.0 + generationVersion: 2.404.3 + releaseVersion: 0.1.5 + configChecksum: 35690181912086c4003337e1ec0bd202 repoURL: https://github.com/livepeer/livepeer-ai-python.git installationURL: https://github.com/livepeer/livepeer-ai-python.git features: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 323556d..8f1e177 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -2,7 +2,7 @@ configVersion: 2.0.0 generation: devContainers: enabled: true - schemaPath: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json + schemaPath: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml sdkClassName: LivepeerAI maintainOpenAPIOrder: true usageSnippets: @@ -15,7 +15,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false python: - version: 0.1.4 + version: 0.1.5 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 29372c3..b5d5412 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,12 +1,11 @@ -speakeasyVersion: 1.377.0 +speakeasyVersion: 1.379.0 sources: livepeer_ai-OAS: sourceNamespace: livepeer-ai-oas - sourceRevisionDigest: sha256:eaa66566d7629ca0b84b572f39576e8b38b87667aaa688ea98cf87629f7647ea - sourceBlobDigest: sha256:88b77186fc98fe193435d3069ab2e85fe4d404e802e4e23761979e984649ff70 + sourceRevisionDigest: sha256:6bd4223c4f6c0a9963663242f118035124c716e7c436049608219d24717cf099 + sourceBlobDigest: sha256:a025967b0b9169763c785bb89478cb7716f70241d4e11d762734f3655b7fb0e5 tags: - latest - - main targets: livepeer-ai: source: livepeer_ai-OAS @@ -17,18 +16,18 @@ targets: livepeer-ai-python: source: livepeer_ai-OAS sourceNamespace: livepeer-ai-oas - sourceRevisionDigest: sha256:eaa66566d7629ca0b84b572f39576e8b38b87667aaa688ea98cf87629f7647ea - sourceBlobDigest: sha256:88b77186fc98fe193435d3069ab2e85fe4d404e802e4e23761979e984649ff70 + sourceRevisionDigest: sha256:6bd4223c4f6c0a9963663242f118035124c716e7c436049608219d24717cf099 + sourceBlobDigest: sha256:a025967b0b9169763c785bb89478cb7716f70241d4e11d762734f3655b7fb0e5 codeSamplesNamespace: code-samples-python-livepeer-python - codeSamplesRevisionDigest: sha256:4b4d5d53563acb0a29f44c857bb3b87e8455831c298a17c1b3d02a7f235caca0 - outLocation: /github/workspace/repo + codeSamplesRevisionDigest: sha256:901ab5f5b4d211b224c6482b451f186affa42c56cdf08c25f191f875146987d5 + outLocation: /home/ricks/development/livepeer/ai/livepeer-ai-python workflow: workflowVersion: 1.0.0 speakeasyVersion: latest sources: livepeer_ai-OAS: inputs: - - location: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json + - location: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml registry: location: registry.speakeasyapi.dev/livepeer-8mq/livepeer-ai/livepeer-ai-oas targets: diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 7f8f15c..237ee69 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -3,7 +3,7 @@ speakeasyVersion: latest sources: livepeer_ai-OAS: inputs: - - location: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json + - location: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml registry: location: registry.speakeasyapi.dev/livepeer-8mq/livepeer-ai/livepeer-ai-oas targets: diff --git a/README.md b/README.md index 6df126a..2030a82 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ Welcome to the [Livepeer AI](https://livepeer.ai/) Python! This library offers a PIP ```bash -pip install git+.git +pip install git+https://github.com/livepeer/livepeer-ai-python.git ``` Poetry ```bash -poetry add git+.git +poetry add git+https://github.com/livepeer/livepeer-ai-python.git ``` diff --git a/codeSamples.yaml b/codeSamples.yaml index 5f94439..dc05906 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,6 +3,12 @@ info: title: CodeSamples overlay for python target version: 0.0.0 actions: + - target: $["paths"]["/audio-to-text"]["post"] + update: + "x-codeSamples": + - "lang": "python" + "label": "audio_to_text" + "source": "from livepeer_ai import LivepeerAI\n\ns = LivepeerAI(\n http_bearer=\"\",\n)\n\n\nres = s.audio_to_text(request={\n \"audio\": {\n \"file_name\": \"your_file_here\",\n \"content\": open(\"\", \"rb\"),\n },\n})\n\nif res.text_response is not None:\n # handle response\n pass" - target: $["paths"]["/text-to-image"]["post"] update: "x-codeSamples": @@ -27,9 +33,3 @@ actions: - "lang": "python" "label": "upscale" "source": "from livepeer_ai import LivepeerAI\n\ns = LivepeerAI(\n http_bearer=\"\",\n)\n\n\nres = s.upscale(request={\n \"prompt\": \"\",\n \"image\": {\n \"file_name\": \"your_file_here\",\n \"content\": open(\"\", \"rb\"),\n },\n})\n\nif res.image_response is not None:\n # handle response\n pass" - - target: $["paths"]["/audio-to-text"]["post"] - update: - "x-codeSamples": - - "lang": "python" - "label": "audio_to_text" - "source": "from livepeer_ai import LivepeerAI\n\ns = LivepeerAI(\n http_bearer=\"\",\n)\n\n\nres = s.audio_to_text(request={\n \"audio\": {\n \"file_name\": \"your_file_here\",\n \"content\": open(\"\", \"rb\"),\n },\n})\n\nif res.text_response is not None:\n # handle response\n pass" diff --git a/docs/models/apierror.md b/docs/models/apierror.md index 7e360c8..fdd254a 100644 --- a/docs/models/apierror.md +++ b/docs/models/apierror.md @@ -1,8 +1,10 @@ # APIError +API error response model. + ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `msg` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| `msg` | *str* | :heavy_check_mark: | The error message. | \ No newline at end of file diff --git a/docs/models/chunk.md b/docs/models/chunk.md index 2b9b6b2..7296b7f 100644 --- a/docs/models/chunk.md +++ b/docs/models/chunk.md @@ -1,9 +1,11 @@ # Chunk +A chunk of text with a timestamp. + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `timestamp` | List[*Any*] | :heavy_check_mark: | N/A | -| `text` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `timestamp` | List[*Any*] | :heavy_check_mark: | The timestamp of the chunk. | +| `text` | *str* | :heavy_check_mark: | The text of the chunk. | \ No newline at end of file diff --git a/docs/models/httperror.md b/docs/models/httperror.md index 3dee07c..fb61e1f 100644 --- a/docs/models/httperror.md +++ b/docs/models/httperror.md @@ -1,10 +1,10 @@ # HTTPError -Bad Request +HTTP error response model. ## Fields | Field | Type | Required | Description | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `detail` | [models.APIError](../models/apierror.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `detail` | [models.APIError](../models/apierror.md) | :heavy_check_mark: | Detailed error information. | \ No newline at end of file diff --git a/docs/models/imageresponse.md b/docs/models/imageresponse.md index cb60b4b..1bfe2f2 100644 --- a/docs/models/imageresponse.md +++ b/docs/models/imageresponse.md @@ -1,8 +1,10 @@ # ImageResponse +Response model for image generation. + ## Fields | Field | Type | Required | Description | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `images` | List[[models.Media](../models/media.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `images` | List[[models.Media](../models/media.md)] | :heavy_check_mark: | The generated images. | \ No newline at end of file diff --git a/docs/models/media.md b/docs/models/media.md index 98c16b6..b107bed 100644 --- a/docs/models/media.md +++ b/docs/models/media.md @@ -1,10 +1,12 @@ # Media +A media object containing information about the generated media. + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `url` | *str* | :heavy_check_mark: | N/A | -| `seed` | *int* | :heavy_check_mark: | N/A | -| `nsfw` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `url` | *str* | :heavy_check_mark: | The URL where the media can be accessed. | +| `seed` | *int* | :heavy_check_mark: | The seed used to generate the media. | +| `nsfw` | *bool* | :heavy_check_mark: | Whether the media was flagged as NSFW. | \ No newline at end of file diff --git a/docs/models/textresponse.md b/docs/models/textresponse.md index 1863737..68cffbe 100644 --- a/docs/models/textresponse.md +++ b/docs/models/textresponse.md @@ -1,9 +1,11 @@ # TextResponse +Response model for text generation. + ## Fields | Field | Type | Required | Description | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `text` | *str* | :heavy_check_mark: | N/A | -| `chunks` | List[[models.Chunk](../models/chunk.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `text` | *str* | :heavy_check_mark: | The generated text. | +| `chunks` | List[[models.Chunk](../models/chunk.md)] | :heavy_check_mark: | The generated text chunks. | \ No newline at end of file diff --git a/docs/models/videoresponse.md b/docs/models/videoresponse.md index d6be36e..f9073c5 100644 --- a/docs/models/videoresponse.md +++ b/docs/models/videoresponse.md @@ -1,8 +1,10 @@ # VideoResponse +Response model for image generation. + ## Fields | Field | Type | Required | Description | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `images` | List[[models.Media](../models/media.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `images` | List[[models.Media](../models/media.md)] | :heavy_check_mark: | The generated images. | \ No newline at end of file diff --git a/docs/sdks/livepeerai/README.md b/docs/sdks/livepeerai/README.md index 221a071..320fec7 100644 --- a/docs/sdks/livepeerai/README.md +++ b/docs/sdks/livepeerai/README.md @@ -14,7 +14,7 @@ Livepeer AI Runner: An application to run AI pipelines ## text_to_image -Text To Image +Generate images from text prompts. ### Example Usage @@ -58,7 +58,7 @@ if res.image_response is not None: ## image_to_image -Image To Image +Apply image transformations to a provided image. ### Example Usage @@ -106,7 +106,7 @@ if res.image_response is not None: ## image_to_video -Image To Video +Generate a video from a provided image. ### Example Usage @@ -153,7 +153,7 @@ if res.video_response is not None: ## upscale -Upscale +Upscale an image by increasing its resolution. ### Example Usage @@ -201,7 +201,7 @@ if res.image_response is not None: ## audio_to_text -Audio To Text +Transcribe audio files to text. ### Example Usage diff --git a/pyproject.toml b/pyproject.toml index 69107d4..8c5fd3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,10 @@ [tool.poetry] name = "livepeer-ai" -version = "0.1.4" +version = "0.1.5" description = "Python Client SDK for the Livepeer AI API." authors = ["Livepeer",] readme = "README-PYPI.md" +repository = "https://github.com/livepeer/livepeer-ai-python.git" packages = [ { include = "livepeer_ai", from = "src" } ] diff --git a/scripts/prepare-readme.py b/scripts/prepare-readme.py index a8ef8ea..8e46a80 100644 --- a/scripts/prepare-readme.py +++ b/scripts/prepare-readme.py @@ -1,9 +1,33 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +import re import shutil try: - shutil.copyfile('README.md', 'README-PYPI.md') + with open("README.md", "r") as rh: + readme_contents = rh.read() + GITHUB_URL = "https://github.com/livepeer/livepeer-ai-python.git" + GITHUB_URL = ( + GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL + ) + # links on PyPI should have absolute URLs + readme_contents = re.sub( + r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))", + lambda m: m.group(1) + + GITHUB_URL + + "/blob/master/" + + m.group(2) + + m.group(3), + readme_contents, + ) + + with open("README-PYPI.md", "w") as wh: + wh.write(readme_contents) except Exception as e: - print("Failed to copy README.md to README-PYPI.md") - print(e) + try: + print("Failed to rewrite README.md to README-PYPI.md, copying original instead") + print(e) + shutil.copyfile("README.md", "README-PYPI.md") + except Exception as e: + print("Failed to copy README.md to README-PYPI.md") + print(e) diff --git a/src/livepeer_ai/_hooks/__init__.py b/src/livepeer_ai/_hooks/__init__.py index e763be4..2ee66cd 100644 --- a/src/livepeer_ai/_hooks/__init__.py +++ b/src/livepeer_ai/_hooks/__init__.py @@ -2,3 +2,4 @@ from .sdkhooks import * from .types import * +from .registration import * diff --git a/src/livepeer_ai/_hooks/registration.py b/src/livepeer_ai/_hooks/registration.py new file mode 100644 index 0000000..1db6a52 --- /dev/null +++ b/src/livepeer_ai/_hooks/registration.py @@ -0,0 +1,13 @@ +from .types import Hooks + + +# This file is only ever generated once on the first generation and then is free to be modified. +# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them +# in this file or in separate files in the hooks folder. + + +def init_hooks(hooks: Hooks): + # pylint: disable=unused-argument + """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook + with an instance of a hook that implements that specific Hook interface + Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance""" diff --git a/src/livepeer_ai/_hooks/sdkhooks.py b/src/livepeer_ai/_hooks/sdkhooks.py index 492f637..733bdc0 100644 --- a/src/livepeer_ai/_hooks/sdkhooks.py +++ b/src/livepeer_ai/_hooks/sdkhooks.py @@ -2,6 +2,7 @@ import httpx from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks +from .registration import init_hooks from typing import List, Optional, Tuple from livepeer_ai.httpclient import HttpClient @@ -11,6 +12,7 @@ def __init__(self) -> None: self.before_request_hooks: List[BeforeRequestHook] = [] self.after_success_hooks: List[AfterSuccessHook] = [] self.after_error_hooks: List[AfterErrorHook] = [] + init_hooks(self) def register_sdk_init_hook(self, hook: SDKInitHook) -> None: self.sdk_init_hooks.append(hook) diff --git a/src/livepeer_ai/models/apierror.py b/src/livepeer_ai/models/apierror.py index af0040f..126cfb4 100644 --- a/src/livepeer_ai/models/apierror.py +++ b/src/livepeer_ai/models/apierror.py @@ -6,9 +6,15 @@ class APIErrorTypedDict(TypedDict): + r"""API error response model.""" + msg: str + r"""The error message.""" class APIError(BaseModel): + r"""API error response model.""" + msg: str + r"""The error message.""" diff --git a/src/livepeer_ai/models/chunk.py b/src/livepeer_ai/models/chunk.py index 7d65807..bb30e51 100644 --- a/src/livepeer_ai/models/chunk.py +++ b/src/livepeer_ai/models/chunk.py @@ -6,11 +6,19 @@ class ChunkTypedDict(TypedDict): + r"""A chunk of text with a timestamp.""" + timestamp: List[Any] + r"""The timestamp of the chunk.""" text: str + r"""The text of the chunk.""" class Chunk(BaseModel): + r"""A chunk of text with a timestamp.""" + timestamp: List[Any] + r"""The timestamp of the chunk.""" text: str + r"""The text of the chunk.""" diff --git a/src/livepeer_ai/models/httperror.py b/src/livepeer_ai/models/httperror.py index a08a8a1..aea4365 100644 --- a/src/livepeer_ai/models/httperror.py +++ b/src/livepeer_ai/models/httperror.py @@ -7,11 +7,12 @@ class HTTPErrorData(BaseModel): detail: APIError + r"""Detailed error information.""" class HTTPError(Exception): - r"""Bad Request""" + r"""HTTP error response model.""" data: HTTPErrorData def __init__(self, data: HTTPErrorData): diff --git a/src/livepeer_ai/models/imageresponse.py b/src/livepeer_ai/models/imageresponse.py index be831a8..9fe0bc0 100644 --- a/src/livepeer_ai/models/imageresponse.py +++ b/src/livepeer_ai/models/imageresponse.py @@ -7,9 +7,15 @@ class ImageResponseTypedDict(TypedDict): + r"""Response model for image generation.""" + images: List[MediaTypedDict] + r"""The generated images.""" class ImageResponse(BaseModel): + r"""Response model for image generation.""" + images: List[Media] + r"""The generated images.""" diff --git a/src/livepeer_ai/models/media.py b/src/livepeer_ai/models/media.py index dfdba09..d4f0a98 100644 --- a/src/livepeer_ai/models/media.py +++ b/src/livepeer_ai/models/media.py @@ -6,13 +6,23 @@ class MediaTypedDict(TypedDict): + r"""A media object containing information about the generated media.""" + url: str + r"""The URL where the media can be accessed.""" seed: int + r"""The seed used to generate the media.""" nsfw: bool + r"""Whether the media was flagged as NSFW.""" class Media(BaseModel): + r"""A media object containing information about the generated media.""" + url: str + r"""The URL where the media can be accessed.""" seed: int + r"""The seed used to generate the media.""" nsfw: bool + r"""Whether the media was flagged as NSFW.""" diff --git a/src/livepeer_ai/models/textresponse.py b/src/livepeer_ai/models/textresponse.py index db4d968..c416240 100644 --- a/src/livepeer_ai/models/textresponse.py +++ b/src/livepeer_ai/models/textresponse.py @@ -7,11 +7,19 @@ class TextResponseTypedDict(TypedDict): + r"""Response model for text generation.""" + text: str + r"""The generated text.""" chunks: List[ChunkTypedDict] + r"""The generated text chunks.""" class TextResponse(BaseModel): + r"""Response model for text generation.""" + text: str + r"""The generated text.""" chunks: List[Chunk] + r"""The generated text chunks.""" diff --git a/src/livepeer_ai/models/videoresponse.py b/src/livepeer_ai/models/videoresponse.py index 76b2a25..c909bb9 100644 --- a/src/livepeer_ai/models/videoresponse.py +++ b/src/livepeer_ai/models/videoresponse.py @@ -7,9 +7,15 @@ class VideoResponseTypedDict(TypedDict): + r"""Response model for image generation.""" + images: List[MediaTypedDict] + r"""The generated images.""" class VideoResponse(BaseModel): + r"""Response model for image generation.""" + images: List[Media] + r"""The generated images.""" diff --git a/src/livepeer_ai/sdk.py b/src/livepeer_ai/sdk.py index 3e18df3..684ed3e 100644 --- a/src/livepeer_ai/sdk.py +++ b/src/livepeer_ai/sdk.py @@ -95,6 +95,8 @@ def text_to_image( ) -> models.TextToImageResponse: r"""Text To Image + Generate images from text prompts. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -175,6 +177,8 @@ async def text_to_image_async( ) -> models.TextToImageResponse: r"""Text To Image + Generate images from text prompts. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -255,6 +259,8 @@ def image_to_image( ) -> models.ImageToImageResponse: r"""Image To Image + Apply image transformations to a provided image. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -335,6 +341,8 @@ async def image_to_image_async( ) -> models.ImageToImageResponse: r"""Image To Image + Apply image transformations to a provided image. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -415,6 +423,8 @@ def image_to_video( ) -> models.ImageToVideoResponse: r"""Image To Video + Generate a video from a provided image. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -495,6 +505,8 @@ async def image_to_video_async( ) -> models.ImageToVideoResponse: r"""Image To Video + Generate a video from a provided image. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -575,6 +587,8 @@ def upscale( ) -> models.UpscaleResponse: r"""Upscale + Upscale an image by increasing its resolution. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -655,6 +669,8 @@ async def upscale_async( ) -> models.UpscaleResponse: r"""Upscale + Upscale an image by increasing its resolution. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -735,6 +751,8 @@ def audio_to_text( ) -> models.AudioToTextResponse: r"""Audio To Text + Transcribe audio files to text. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -815,6 +833,8 @@ async def audio_to_text_async( ) -> models.AudioToTextResponse: r"""Audio To Text + Transcribe audio files to text. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method diff --git a/src/livepeer_ai/sdkconfiguration.py b/src/livepeer_ai/sdkconfiguration.py index ab6acdf..f8273bb 100644 --- a/src/livepeer_ai/sdkconfiguration.py +++ b/src/livepeer_ai/sdkconfiguration.py @@ -27,9 +27,9 @@ class SDKConfiguration: server_idx: Optional[int] = 0 language: str = "python" openapi_doc_version: str = "v0.1.2" - sdk_version: str = "0.1.4" - gen_version: str = "2.404.0" - user_agent: str = "speakeasy-sdk/python 0.1.4 2.404.0 v0.1.2 livepeer-ai" + sdk_version: str = "0.1.5" + gen_version: str = "2.404.3" + user_agent: str = "speakeasy-sdk/python 0.1.5 2.404.3 v0.1.2 livepeer-ai" retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) timeout_ms: Optional[int] = None