Skip to content

Commit

Permalink
chore: update OpenAPI spec filetype (#4)
Browse files Browse the repository at this point in the history
This commit ensures that the SDKs are generated using the new yaml
OpenAPI spec instead of the Json one.
  • Loading branch information
rickstaa authored Aug 26, 2024
1 parent 40c3796 commit 681fb5e
Show file tree
Hide file tree
Showing 34 changed files with 272 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,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 typescript -i {INPUT_OPERATION_ID} -o ./samples
speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml -l typescript -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 typescript -n {INPUT_TAG_NAME} -o ./samples
speakeasy generate usage -s https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.yaml -l typescript -n {INPUT_TAG_NAME} -o ./samples
```
2 changes: 1 addition & 1 deletion .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.yaml -l typescript -o samples/root.ts
12 changes: 6 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
lockVersion: 2.0.0
id: 8766970f-4397-4dff-8082-81333329536d
management:
docChecksum: c222ffbf28e5f62770dc8cbd99010f96
docChecksum: 83217fd4aabc3c12bd4c7c073283767b
docVersion: v0.1.2
speakeasyVersion: 1.377.0
generationVersion: 2.404.0
releaseVersion: 0.1.3
configChecksum: eefe057d141baa2c05728e0706976ccb
speakeasyVersion: 1.379.0
generationVersion: 2.404.3
releaseVersion: 0.1.4
configChecksum: dc87f155690efe292553b5f415f0fe91
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.10
constsAndDefaults: 0.1.11
core: 3.14.1
defaultEnabledRetries: 0.1.0
devContainers: 2.90.0
Expand Down
4 changes: 2 additions & 2 deletions .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -15,7 +15,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
typescript:
version: 0.1.3
version: 0.1.4
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
speakeasyVersion: 1.377.0
speakeasyVersion: 1.379.0
sources:
livepeer-ai-OAS:
sourceNamespace: livepeer-ai-oas
sourceRevisionDigest: sha256:8e8a89195aea8aa7f8c0c2674946515904ddca346b557a631cf5a4c6c81529d6
sourceBlobDigest: sha256:e2549433c2d09c42e52916d511a18269d4ce6e728cd487f043ab8e82991b4d36
sourceRevisionDigest: sha256:382bb92d3c451ea10e067c4c0d9eeaedc82657215d22432f9d86a4981882cb9e
sourceBlobDigest: sha256:ee28086f4eaa298e1404a97caca0662f99cb75f174c0165e35bdbf805b0f19ce
tags:
- latest
targets:
livepeer-ai-ts:
source: livepeer-ai-OAS
sourceNamespace: livepeer-ai-oas
sourceRevisionDigest: sha256:8e8a89195aea8aa7f8c0c2674946515904ddca346b557a631cf5a4c6c81529d6
sourceBlobDigest: sha256:e2549433c2d09c42e52916d511a18269d4ce6e728cd487f043ab8e82991b4d36
sourceRevisionDigest: sha256:382bb92d3c451ea10e067c4c0d9eeaedc82657215d22432f9d86a4981882cb9e
sourceBlobDigest: sha256:ee28086f4eaa298e1404a97caca0662f99cb75f174c0165e35bdbf805b0f19ce
codeSamplesNamespace: code-samples-typescript-livepeer-ts
codeSamplesRevisionDigest: sha256:182828739e43b7d566a95d4d25cec1db4cfede926d44f4f080defb317f99f553
codeSamplesRevisionDigest: sha256:3d03e6e38406e206f344c9070b67ec7bd446729e17847a349337cffdf123a4eb
outLocation: /home/ricks/development/livepeer/ai/livepeer-ai-js
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:
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
130 changes: 108 additions & 22 deletions codeSamples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,119 @@ info:
title: CodeSamples overlay for typescript target
version: 0.0.0
actions:
- target: $["paths"]["/image-to-video"]["post"]
update:
x-codeSamples:
- lang: typescript
label: image_to_video
source: |-
import { LivepeerAI } from "livepeer-ai";
import { openAsBlob } from "node:fs";
const livepeerAI = new LivepeerAI({
httpBearer: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeerAI.imageToVideo({
image: await openAsBlob("./sample-file"),
});
// Handle the result
console.log(result)
}
run();
- 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: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeerAI.upscale({\n prompt: \"<value>\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
x-codeSamples:
- lang: typescript
label: upscale
source: |-
import { LivepeerAI } from "livepeer-ai";
import { openAsBlob } from "node:fs";
const livepeerAI = new LivepeerAI({
httpBearer: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeerAI.upscale({
prompt: "<value>",
image: await openAsBlob("./sample-file"),
});
// Handle the result
console.log(result)
}
run();
- 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: \"<YOUR_BEARER_TOKEN_HERE>\",\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();"
x-codeSamples:
- lang: typescript
label: audio_to_text
source: |-
import { LivepeerAI } from "livepeer-ai";
import { openAsBlob } from "node:fs";
const livepeerAI = new LivepeerAI({
httpBearer: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeerAI.audioToText({
audio: await openAsBlob("./sample-file"),
});
// Handle the result
console.log(result)
}
run();
- 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: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeerAI.textToImage({\n prompt: \"<value>\",\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();"
x-codeSamples:
- lang: typescript
label: text_to_image
source: |-
import { LivepeerAI } from "livepeer-ai";
const livepeerAI = new LivepeerAI({
httpBearer: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeerAI.textToImage({
prompt: "<value>",
});
// Handle the result
console.log(result)
}
run();
- 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: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeerAI.imageToImage({\n prompt: \"<value>\",\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: \"<YOUR_BEARER_TOKEN_HERE>\",\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();"
x-codeSamples:
- lang: typescript
label: image_to_image
source: |-
import { LivepeerAI } from "livepeer-ai";
import { openAsBlob } from "node:fs";
const livepeerAI = new LivepeerAI({
httpBearer: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeerAI.imageToImage({
prompt: "<value>",
image: await openAsBlob("./sample-file"),
});
// Handle the result
console.log(result)
}
run();
4 changes: 3 additions & 1 deletion docs/models/components/apierror.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# APIError

API error response model.

## Example Usage

```typescript
Expand All @@ -14,4 +16,4 @@ let value: APIError = {

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `msg` | *string* | :heavy_check_mark: | N/A |
| `msg` | *string* | :heavy_check_mark: | The error message. |
10 changes: 6 additions & 4 deletions docs/models/components/chunk.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Chunk

A chunk of text with a timestamp.

## Example Usage

```typescript
Expand All @@ -13,7 +15,7 @@ let value: Chunk = {

## Fields

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `timestamp` | *any*[] | :heavy_check_mark: | N/A |
| `text` | *string* | :heavy_check_mark: | N/A |
| Field | Type | Required | Description |
| --------------------------- | --------------------------- | --------------------------- | --------------------------- |
| `timestamp` | *any*[] | :heavy_check_mark: | The timestamp of the chunk. |
| `text` | *string* | :heavy_check_mark: | The text of the chunk. |
4 changes: 3 additions & 1 deletion docs/models/components/imageresponse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ImageResponse

Response model for image generation.

## Example Usage

```typescript
Expand All @@ -20,4 +22,4 @@ let value: ImageResponse = {

| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `images` | [components.Media](../../models/components/media.md)[] | :heavy_check_mark: | N/A |
| `images` | [components.Media](../../models/components/media.md)[] | :heavy_check_mark: | The generated images. |
12 changes: 7 additions & 5 deletions docs/models/components/media.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Media

A media object containing information about the generated media.

## Example Usage

```typescript
Expand All @@ -14,8 +16,8 @@ let value: Media = {

## Fields

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `url` | *string* | :heavy_check_mark: | N/A |
| `seed` | *number* | :heavy_check_mark: | N/A |
| `nsfw` | *boolean* | :heavy_check_mark: | N/A |
| Field | Type | Required | Description |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| `url` | *string* | :heavy_check_mark: | The URL where the media can be accessed. |
| `seed` | *number* | :heavy_check_mark: | The seed used to generate the media. |
| `nsfw` | *boolean* | :heavy_check_mark: | Whether the media was flagged as NSFW. |
6 changes: 4 additions & 2 deletions docs/models/components/textresponse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TextResponse

Response model for text generation.

## Example Usage

```typescript
Expand All @@ -20,5 +22,5 @@ let value: TextResponse = {

| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `text` | *string* | :heavy_check_mark: | N/A |
| `chunks` | [components.Chunk](../../models/components/chunk.md)[] | :heavy_check_mark: | N/A |
| `text` | *string* | :heavy_check_mark: | The generated text. |
| `chunks` | [components.Chunk](../../models/components/chunk.md)[] | :heavy_check_mark: | The generated text chunks. |
4 changes: 3 additions & 1 deletion docs/models/components/videoresponse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# VideoResponse

Response model for image generation.

## Example Usage

```typescript
Expand All @@ -20,4 +22,4 @@ let value: VideoResponse = {

| Field | Type | Required | Description |
| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
| `images` | [components.Media](../../models/components/media.md)[] | :heavy_check_mark: | N/A |
| `images` | [components.Media](../../models/components/media.md)[] | :heavy_check_mark: | The generated images. |
4 changes: 2 additions & 2 deletions docs/models/errors/httperror.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HTTPError

Bad Request
HTTP error response model.

## Example Usage

Expand All @@ -14,4 +14,4 @@ import { HTTPError } from "livepeer-ai/models/errors";

| Field | Type | Required | Description |
| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
| `detail` | [components.APIError](../../models/components/apierror.md) | :heavy_check_mark: | N/A |
| `detail` | [components.APIError](../../models/components/apierror.md) | :heavy_check_mark: | Detailed error information. |
Loading

0 comments on commit 681fb5e

Please sign in to comment.