From 4bc1d5751325023abb026d55444fd2078eba9460 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Wed, 21 Aug 2024 11:07:57 +0200 Subject: [PATCH] refactor: rename SDK class This commit renames the SDK class so that it adheres to naming conventions. --- .devcontainer/setup.sh | 2 +- .speakeasy/gen.lock | 16 ++++---- .speakeasy/gen.yaml | 4 +- .speakeasy/workflow.lock | 15 ++++--- FUNCTIONS.md | 8 ++-- README.md | 62 +++++++++++++++-------------- USAGE.md | 6 +-- codeSamples.yaml | 20 +++++----- docs/sdks/livepeerai/README.md | 72 +++++++++++++++++----------------- jsr.json | 2 +- package-lock.json | 4 +- package.json | 2 +- src/core.ts | 2 +- src/funcs/audioToText.ts | 4 +- src/funcs/imageToImage.ts | 4 +- src/funcs/imageToVideo.ts | 4 +- src/funcs/textToImage.ts | 4 +- src/funcs/upscale.ts | 4 +- src/lib/config.ts | 8 ++-- src/sdk/sdk.ts | 2 +- 20 files changed, 123 insertions(+), 122 deletions(-) diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index ceb6cb9..6350f66 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -27,4 +27,4 @@ EOL echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json # Generate starter usage sample with speakeasy -speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json -l typescript -o samples/root.ts +speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json -l typescript -o samples/root.ts \ No newline at end of file diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7eaf644..1ff2c97 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 8766970f-4397-4dff-8082-81333329536d management: - docChecksum: 510cfa2da9f90c7685f770ff2ba4eca6 - docVersion: 0.1.0 - speakeasyVersion: 1.372.0 - generationVersion: 2.399.0 - releaseVersion: 0.0.2 - configChecksum: 8822ace0e62551968845376ac95e6eec + docChecksum: c222ffbf28e5f62770dc8cbd99010f96 + docVersion: v0.1.2 + speakeasyVersion: 1.376.1 + generationVersion: 2.402.5 + releaseVersion: 0.1.2 + configChecksum: b0d2f710722fbf4899c5f3e77fcbd33f repoURL: https://github.com/livepeer/livepeer-ai-js.git installationURL: https://github.com/livepeer/livepeer-ai-js features: typescript: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.8 - core: 3.13.2 + constsAndDefaults: 0.1.10 + core: 3.14.1 defaultEnabledRetries: 0.1.0 devContainers: 2.90.0 envVarSecurityUsage: 0.1.1 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c06df3c..1973332 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -3,7 +3,7 @@ generation: devContainers: enabled: true schemaPath: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json - sdkClassName: LivepeerAi + sdkClassName: LivepeerAI maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample @@ -15,7 +15,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 0.0.2 + version: 0.1.2 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0402256..80463a4 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,12 +1,11 @@ -speakeasyVersion: 1.372.0 +speakeasyVersion: 1.376.1 sources: livepeer-ai-OAS: sourceNamespace: livepeer-ai-oas - sourceRevisionDigest: sha256:38afa7f1861a22fb18d400f362331305d3d261805959e73bf3ab6eb0cb4845a7 - sourceBlobDigest: sha256:33f4138b25cfe97858b17c1966a1559000e32e20e588fa2298902060da23900c + sourceRevisionDigest: sha256:c3a8dccb8a3f822b82931d3d9e3cb7f4eb6d164d3f289a3c0c7b3dd98de913d3 + sourceBlobDigest: sha256:e2549433c2d09c42e52916d511a18269d4ce6e728cd487f043ab8e82991b4d36 tags: - latest - - main targets: livepeer-ai: source: livepeer-ai-OAS @@ -17,11 +16,11 @@ targets: livepeer-ts: source: livepeer-ai-OAS sourceNamespace: livepeer-ai-oas - sourceRevisionDigest: sha256:38afa7f1861a22fb18d400f362331305d3d261805959e73bf3ab6eb0cb4845a7 - sourceBlobDigest: sha256:33f4138b25cfe97858b17c1966a1559000e32e20e588fa2298902060da23900c + sourceRevisionDigest: sha256:c3a8dccb8a3f822b82931d3d9e3cb7f4eb6d164d3f289a3c0c7b3dd98de913d3 + sourceBlobDigest: sha256:e2549433c2d09c42e52916d511a18269d4ce6e728cd487f043ab8e82991b4d36 codeSamplesNamespace: code-samples-typescript-livepeer-ts - codeSamplesRevisionDigest: sha256:a4cf6a478083c4c544e2193d4ee083013ee403df4eadd4c184a66a66b8cfe7f1 - outLocation: /github/workspace/repo + codeSamplesRevisionDigest: sha256:f5f04f8efc644b6e81cd50641403c143e83a31d4136e8a7b99d62473c78ce7fb + outLocation: /home/ricks/development/livepeer/ai/livepeer-ai-js workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/FUNCTIONS.md b/FUNCTIONS.md index 8816edd..b462137 100644 --- a/FUNCTIONS.md +++ b/FUNCTIONS.md @@ -19,18 +19,18 @@ specific category of applications. ## Example ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { textToImage } from "livepeer-ai/funcs/textToImage.js"; import { SDKValidationError } from "livepeer-ai/models/errors/sdkvalidationerror.js"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await textToImage(livepeerAi, { + const res = await textToImage(livepeerAI, { prompt: "", }); diff --git a/README.md b/README.md index 4c425cc..0e47be0 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md). ### Example ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -75,7 +75,7 @@ run(); ## Available Resources and Operations -### [LivepeerAi SDK](docs/sdks/livepeerai/README.md) +### [LivepeerAI SDK](docs/sdks/livepeerai/README.md) * [textToImage](docs/sdks/livepeerai/README.md#texttoimage) - Text To Image * [imageToImage](docs/sdks/livepeerai/README.md#imagetoimage) - Image To Image @@ -124,15 +124,15 @@ Certain SDK methods accept files as part of a multi-part request. It is possible > - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob). ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { openAsBlob } from "node:fs"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.imageToImage({ + const result = await livepeerAI.imageToImage({ image: await openAsBlob("./sample-file"), prompt: "", }); @@ -153,14 +153,14 @@ Some of the endpoints in this SDK support retries. If you use the SDK without a To change the default retry strategy for a single API call, simply provide a retryConfig object to the call: ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage( + const result = await livepeerAI.textToImage( { prompt: "", }, @@ -188,9 +188,9 @@ run(); If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization: ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ retryConfig: { strategy: "backoff", backoff: { @@ -205,7 +205,7 @@ const livepeerAi = new LivepeerAi({ }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -233,17 +233,17 @@ Validation errors can also occur when either method arguments or data returned f ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { SDKValidationError } from "livepeer-ai/models/errors"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { let result; try { - result = await livepeerAi.textToImage({ + result = await livepeerAI.textToImage({ prompt: "", }); } catch (err) { @@ -290,15 +290,15 @@ You can override the default server globally by passing a server index to the `s | 0 | `https://dream-gateway.livepeer.cloud` | None | ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ serverIdx: 0, httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -316,15 +316,15 @@ run(); The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example: ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ serverURL: "https://dream-gateway.livepeer.cloud", httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -355,7 +355,7 @@ custom header and a timeout to requests and how to use the `"requestError"` hook to log errors: ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { HTTPClient } from "livepeer-ai/lib/http"; const httpClient = new HTTPClient({ @@ -382,7 +382,7 @@ httpClient.addHook("requestError", (error, request) => { console.groupEnd(); }); -const sdk = new LivepeerAi({ httpClient }); +const sdk = new LivepeerAI({ httpClient }); ``` @@ -399,14 +399,14 @@ This SDK supports the following security scheme globally: To authenticate with the API the `httpBearer` parameter must be set when initializing the SDK client instance. For example: ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -422,15 +422,17 @@ run(); ## Debugging -To log HTTP requests and responses, you can pass a logger that matches `console`'s interface as an SDK option. +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass a logger that matches `console`'s interface as an SDK option. > [!WARNING] > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production. ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const sdk = new LivepeerAi({ debugLogger: console }); +const sdk = new LivepeerAI({ debugLogger: console }); ``` diff --git a/USAGE.md b/USAGE.md index 83d658a..2ac992e 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1,13 +1,13 @@ ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); diff --git a/codeSamples.yaml b/codeSamples.yaml index 2cc53ae..50fe5a2 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,33 +3,33 @@ info: title: CodeSamples overlay for typescript target version: 0.0.0 actions: - - target: $["paths"]["/audio-to-text"]["post"] - update: - "x-codeSamples": - - "lang": "typescript" - "label": "audio_to_text" - "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAi.audioToText({\n audio: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" - target: $["paths"]["/text-to-image"]["post"] update: "x-codeSamples": - "lang": "typescript" "label": "text_to_image" - "source": "import { LivepeerAi } from \"livepeer-ai\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAi.textToImage({\n prompt: \"\",\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + "source": "import { LivepeerAI } from \"livepeer-ai\";\n\nconst livepeerAI = new LivepeerAI({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAI.textToImage({\n prompt: \"\",\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" - target: $["paths"]["/image-to-image"]["post"] update: "x-codeSamples": - "lang": "typescript" "label": "image_to_image" - "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAi.imageToImage({\n prompt: \"\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + "source": "import { LivepeerAI } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAI = new LivepeerAI({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAI.imageToImage({\n prompt: \"\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" - target: $["paths"]["/image-to-video"]["post"] update: "x-codeSamples": - "lang": "typescript" "label": "image_to_video" - "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAi.imageToVideo({\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + "source": "import { LivepeerAI } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAI = new LivepeerAI({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAI.imageToVideo({\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" - target: $["paths"]["/upscale"]["post"] update: "x-codeSamples": - "lang": "typescript" "label": "upscale" - "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAi.upscale({\n prompt: \"\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + "source": "import { LivepeerAI } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAI = new LivepeerAI({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAI.upscale({\n prompt: \"\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + - target: $["paths"]["/audio-to-text"]["post"] + update: + "x-codeSamples": + - "lang": "typescript" + "label": "audio_to_text" + "source": "import { LivepeerAI } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAI = new LivepeerAI({\n httpBearer: \"\",\n});\n\nasync function run() {\n const result = await livepeerAI.audioToText({\n audio: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" diff --git a/docs/sdks/livepeerai/README.md b/docs/sdks/livepeerai/README.md index f6a61c7..cb5f37e 100644 --- a/docs/sdks/livepeerai/README.md +++ b/docs/sdks/livepeerai/README.md @@ -1,4 +1,4 @@ -# LivepeerAi SDK +# LivepeerAI SDK ## Overview @@ -20,14 +20,14 @@ Text To Image ### Example Usage ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.textToImage({ + const result = await livepeerAI.textToImage({ prompt: "", }); @@ -44,17 +44,17 @@ run(); The standalone function version of this method: ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { textToImage } from "livepeer-ai/funcs/textToImage.js"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await textToImage(livepeerAi, { + const res = await textToImage(livepeerAI, { prompt: "", }); @@ -99,15 +99,15 @@ Image To Image ### Example Usage ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { openAsBlob } from "node:fs"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.imageToImage({ + const result = await livepeerAI.imageToImage({ image: await openAsBlob("./sample-file"), prompt: "", }); @@ -125,18 +125,18 @@ run(); The standalone function version of this method: ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { imageToImage } from "livepeer-ai/funcs/imageToImage.js"; import { openAsBlob } from "node:fs"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await imageToImage(livepeerAi, { + const res = await imageToImage(livepeerAI, { image: await openAsBlob("./sample-file"), prompt: "", }); @@ -182,15 +182,15 @@ Image To Video ### Example Usage ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { openAsBlob } from "node:fs"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.imageToVideo({ + const result = await livepeerAI.imageToVideo({ image: await openAsBlob("./sample-file"), }); @@ -207,18 +207,18 @@ run(); The standalone function version of this method: ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { imageToVideo } from "livepeer-ai/funcs/imageToVideo.js"; import { openAsBlob } from "node:fs"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await imageToVideo(livepeerAi, { + const res = await imageToVideo(livepeerAI, { image: await openAsBlob("./sample-file"), }); @@ -263,15 +263,15 @@ Upscale ### Example Usage ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { openAsBlob } from "node:fs"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.upscale({ + const result = await livepeerAI.upscale({ image: await openAsBlob("./sample-file"), prompt: "", }); @@ -289,18 +289,18 @@ run(); The standalone function version of this method: ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { upscale } from "livepeer-ai/funcs/upscale.js"; import { openAsBlob } from "node:fs"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await upscale(livepeerAi, { + const res = await upscale(livepeerAI, { image: await openAsBlob("./sample-file"), prompt: "", }); @@ -346,15 +346,15 @@ Audio To Text ### Example Usage ```typescript -import { LivepeerAi } from "livepeer-ai"; +import { LivepeerAI } from "livepeer-ai"; import { openAsBlob } from "node:fs"; -const livepeerAi = new LivepeerAi({ +const livepeerAI = new LivepeerAI({ httpBearer: "", }); async function run() { - const result = await livepeerAi.audioToText({ + const result = await livepeerAI.audioToText({ audio: await openAsBlob("./sample-file"), }); @@ -371,18 +371,18 @@ run(); The standalone function version of this method: ```typescript -import { LivepeerAiCore } from "livepeer-ai/core.js"; +import { LivepeerAICore } from "livepeer-ai/core.js"; import { audioToText } from "livepeer-ai/funcs/audioToText.js"; import { openAsBlob } from "node:fs"; -// Use `LivepeerAiCore` for best tree-shaking performance. +// Use `LivepeerAICore` for best tree-shaking performance. // You can create one instance of it to use across an application. -const livepeerAi = new LivepeerAiCore({ +const livepeerAI = new LivepeerAICore({ httpBearer: "", }); async function run() { - const res = await audioToText(livepeerAi, { + const res = await audioToText(livepeerAI, { audio: await openAsBlob("./sample-file"), }); diff --git a/jsr.json b/jsr.json index d2a49f3..3dd9827 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "livepeer-ai", - "version": "0.0.2", + "version": "0.1.2", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 42947c2..4ff4072 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "livepeer-ai", - "version": "0.0.2", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "livepeer-ai", - "version": "0.0.2", + "version": "0.1.2", "devDependencies": { "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", diff --git a/package.json b/package.json index 4a76346..e2f6b3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "livepeer-ai", - "version": "0.0.2", + "version": "0.1.2", "author": "Livepeer", "main": "./index.js", "sideEffects": false, diff --git a/src/core.ts b/src/core.ts index b7582ba..aa9b777 100644 --- a/src/core.ts +++ b/src/core.ts @@ -10,4 +10,4 @@ import { ClientSDK } from "./lib/sdks.js"; * application and passed around through some dependency injection mechanism to * parts of an application that need to make SDK calls. */ -export class LivepeerAiCore extends ClientSDK {} +export class LivepeerAICore extends ClientSDK {} diff --git a/src/funcs/audioToText.ts b/src/funcs/audioToText.ts index 165da12..ca2ff90 100644 --- a/src/funcs/audioToText.ts +++ b/src/funcs/audioToText.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { LivepeerAiCore } from "../core.js"; +import { LivepeerAICore } from "../core.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; @@ -27,7 +27,7 @@ import { Result } from "../types/fp.js"; * Audio To Text */ export async function audioToText( - client$: LivepeerAiCore, + client$: LivepeerAICore, request: components.BodyAudioToTextAudioToTextPost, options?: RequestOptions ): Promise< diff --git a/src/funcs/imageToImage.ts b/src/funcs/imageToImage.ts index 315301f..082bf12 100644 --- a/src/funcs/imageToImage.ts +++ b/src/funcs/imageToImage.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { LivepeerAiCore } from "../core.js"; +import { LivepeerAICore } from "../core.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; @@ -27,7 +27,7 @@ import { Result } from "../types/fp.js"; * Image To Image */ export async function imageToImage( - client$: LivepeerAiCore, + client$: LivepeerAICore, request: components.BodyImageToImageImageToImagePost, options?: RequestOptions ): Promise< diff --git a/src/funcs/imageToVideo.ts b/src/funcs/imageToVideo.ts index a81d8ce..e3a3b63 100644 --- a/src/funcs/imageToVideo.ts +++ b/src/funcs/imageToVideo.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { LivepeerAiCore } from "../core.js"; +import { LivepeerAICore } from "../core.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; @@ -27,7 +27,7 @@ import { Result } from "../types/fp.js"; * Image To Video */ export async function imageToVideo( - client$: LivepeerAiCore, + client$: LivepeerAICore, request: components.BodyImageToVideoImageToVideoPost, options?: RequestOptions ): Promise< diff --git a/src/funcs/textToImage.ts b/src/funcs/textToImage.ts index fae8a99..11ce183 100644 --- a/src/funcs/textToImage.ts +++ b/src/funcs/textToImage.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { LivepeerAiCore } from "../core.js"; +import { LivepeerAICore } from "../core.js"; import { encodeJSON as encodeJSON$ } from "../lib/encodings.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; @@ -27,7 +27,7 @@ import { Result } from "../types/fp.js"; * Text To Image */ export async function textToImage( - client$: LivepeerAiCore, + client$: LivepeerAICore, request: components.TextToImageParams, options?: RequestOptions ): Promise< diff --git a/src/funcs/upscale.ts b/src/funcs/upscale.ts index 2a198d9..062a3c7 100644 --- a/src/funcs/upscale.ts +++ b/src/funcs/upscale.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { LivepeerAiCore } from "../core.js"; +import { LivepeerAICore } from "../core.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; @@ -27,7 +27,7 @@ import { Result } from "../types/fp.js"; * Upscale */ export async function upscale( - client$: LivepeerAiCore, + client$: LivepeerAICore, request: components.BodyUpscaleUpscalePost, options?: RequestOptions ): Promise< diff --git a/src/lib/config.ts b/src/lib/config.ts index 56e791a..81a1642 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -56,8 +56,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", - openapiDocVersion: "0.1.0", - sdkVersion: "0.0.2", - genVersion: "2.399.0", - userAgent: "speakeasy-sdk/typescript 0.0.2 2.399.0 0.1.0 livepeer-ai", + openapiDocVersion: "v0.1.2", + sdkVersion: "0.1.2", + genVersion: "2.402.5", + userAgent: "speakeasy-sdk/typescript 0.1.2 2.402.5 v0.1.2 livepeer-ai", } as const; diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 524b377..7eb4e29 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -12,7 +12,7 @@ import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; -export class LivepeerAi extends ClientSDK { +export class LivepeerAI extends ClientSDK { /** * Text To Image */