diff --git a/bin/update-version.ts b/bin/update-version.ts index 50cb4a7..c17a2ae 100755 --- a/bin/update-version.ts +++ b/bin/update-version.ts @@ -5,7 +5,7 @@ import { execSync } from "node:child_process"; // NOTE: Merged with API version to produce the full SDK version string // https://docs.substrate.run/versioning -const SDK_VERSION = "1.0.1"; +const SDK_VERSION = "1.0.2"; const ok = (message: string) => console.log("\x1b[32m✓\x1b[0m", message); diff --git a/examples/box.ts b/examples/box.ts new file mode 100755 index 0000000..03e116b --- /dev/null +++ b/examples/box.ts @@ -0,0 +1,38 @@ +#!/usr/bin/env -S npx ts-node --transpileOnly + +import { Substrate, ComputeText, Box, sb } from "substrate"; + +async function main() { + const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"]; + + const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); + + const languages = ["swedish", "ukranian", "thai", "turkish"] as const; + + const texts: Record = languages.reduce( + (nodes, language) => { + return { + ...nodes, + [language]: new ComputeText({ + prompt: sb.interpolate`count to 10 in ${language}`, + max_tokens: 50, + }), + }; + }, + {}, + ); + + const box = new Box({ + value: languages.reduce((obj, language) => { + return { + ...obj, + [language]: texts[language]!.future.text, + }; + }, {}), + }); + + const res = await substrate.run(box); + + console.log({ box: res.get(box) }); +} +main(); diff --git a/examples/if.ts b/examples/if.ts new file mode 100755 index 0000000..21e09d7 --- /dev/null +++ b/examples/if.ts @@ -0,0 +1,63 @@ +#!/usr/bin/env -S npx ts-node --transpileOnly + +import { Substrate, ComputeJSON, Box, If, sb } from "substrate"; + +async function main() { + const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"]; + + const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); + + const planets = ["Jupiter", "Mars"]; + + const sizes = planets.map((planet) => { + return new ComputeJSON({ + prompt: sb.interpolate`How big is ${planet}?`, + json_schema: { + type: "object", + properties: { + planetName: { + type: "string", + description: "The name of the planet", + enum: planets, + }, + radius: { + type: "string", + description: "The radius of the planet in kilometers", + }, + }, + }, + }); + }); + + const [jupiter, mars] = sizes as [ComputeJSON, ComputeJSON]; + const radius = (p: ComputeJSON) => + p.future.json_object.get("radius") as unknown as number; + + const comparison = new ComputeJSON({ + prompt: sb.interpolate`Is ${radius(jupiter)} > ${radius(mars)}?`, + json_schema: { + type: "object", + properties: { + isGreaterThan: { + type: "boolean", + }, + }, + }, + }); + + const result = new If({ + condition: comparison.future.json_object.get("isGreaterThan") as any, + value_if_true: jupiter.future.json_object, + value_if_false: mars.future.json_object, + }); + + const output = new Box({ + value: sb.interpolate`The bigger planet is ${result.future.result.get( + "planetName", + )}!`, + }); + + const res = await substrate.run(output); + console.log(res.get(output)); +} +main(); diff --git a/examples/kitchen-sink.ts b/examples/kitchen-sink.ts index d54aef8..a654309 100755 --- a/examples/kitchen-sink.ts +++ b/examples/kitchen-sink.ts @@ -37,6 +37,8 @@ import { Mixtral8x7BInstruct, Llama3Instruct8B, Llama3Instruct70B, + If, + Box, } from "substrate"; const STAGING = "https://api-staging.substrate.run"; @@ -50,6 +52,22 @@ const ALL_ENVS = [STAGING, PRODUCTION]; const VECTOR_STORE = "kitchen-sink"; const examples = [ + new Box({ + value: { + a: 1, + b: [2, 3, { c: 1 }], + d: { e: [4] }, + }, + }), + new If({ + condition: true, + value_if_true: "yes", + value_if_false: "no", + }), + new FindOrCreateVectorStore({ + collection_name: VECTOR_STORE, + model: "jina-v2", + }), new FindOrCreateVectorStore({ collection_name: VECTOR_STORE, model: "jina-v2", diff --git a/examples/qa.ts b/examples/qa.ts new file mode 100755 index 0000000..039f382 --- /dev/null +++ b/examples/qa.ts @@ -0,0 +1,22 @@ +#!/usr/bin/env -S npx ts-node --transpileOnly + +import { Substrate, Box, sb } from "substrate"; + +async function main() { + const SUBSTRATE_API_KEY = process.env["SUBSTRATE_API_KEY"]; + + const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY }); + + const node = new Box({ + value: { + a: "b", + c: { + d: [1, 2, 3], + }, + }, + }); + const res = await substrate.run(node); + console.log(res.apiResponse.status); + console.log(JSON.stringify(res.json)); +} +main(); diff --git a/package-lock.json b/package-lock.json index 9dc91af..96e5809 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "substrate", - "version": "120240617.0.1", + "version": "120240617.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "substrate", - "version": "120240617.0.1", + "version": "120240617.0.2", "license": "MIT", "dependencies": { "@types/node-fetch": "^2.6.11", diff --git a/package.json b/package.json index 328fe47..bf8f108 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "substrate", - "version": "120240617.0.1", + "version": "120240617.0.2", "description": "The official SDK for the Substrate API", "repository": { "type": "git", diff --git a/src/Future.ts b/src/Future.ts index 0afed93..786f4fd 100644 --- a/src/Future.ts +++ b/src/Future.ts @@ -76,7 +76,7 @@ export class Trace extends Directive { for (let item of this.items) { if (item instanceof Future) { // @ts-expect-error (protected result()) - item = await item.result(); + item = await item._result(); } result = result[item as string | number]; } @@ -127,7 +127,7 @@ export class JQ extends Directive { override async result(): Promise { return this.target instanceof Future ? // @ts-expect-error (accessing protected prop: id) - await this.target.result() + await this.target._result() : this.target; } @@ -166,7 +166,7 @@ export class StringConcat extends Directive { for (let item of this.items) { if (item instanceof Future) { // @ts-expect-error (protected result()) - item = await item.result(); + item = await item._result(); } result = result.concat(item); } @@ -204,7 +204,7 @@ export abstract class Future { return { __$$SB_GRAPH_OP_ID$$__: this._id }; } - protected async result(): Promise { + protected async _result(): Promise { return this._directive.result(); } @@ -263,8 +263,8 @@ export class FutureString extends Future { return FutureString.concat(...[this, ...items]); } - protected override async result(): Promise { - return super.result(); + protected override async _result(): Promise { + return super._result(); } } @@ -273,8 +273,8 @@ export class FutureNumber extends Future {} export abstract class FutureArray extends Future { abstract at(index: number): Future; - protected override async result(): Promise { - return super.result(); + protected override async _result(): Promise { + return super._result(); } } @@ -293,8 +293,8 @@ export abstract class FutureObject extends Future { }, this) as Future; } - protected override async result(): Promise { - return super.result(); + protected override async _result(): Promise { + return super._result(); } } @@ -311,7 +311,7 @@ export class FutureAnyObject extends Future { return new FutureAnyObject(this._directive.next(index)); } - protected override async result(): Promise { - return super.result(); + protected override async _result(): Promise { + return super._result(); } } diff --git a/src/GEN_VERSION b/src/GEN_VERSION index 28ffc7a..08710fd 100644 --- a/src/GEN_VERSION +++ b/src/GEN_VERSION @@ -1 +1 @@ -20240617.20240620 \ No newline at end of file +20240617.20240621 \ No newline at end of file diff --git a/src/Nodes.ts b/src/Nodes.ts index 2ee1ed5..e888936 100644 --- a/src/Nodes.ts +++ b/src/Nodes.ts @@ -1,7 +1,7 @@ /** * 𐃏 Substrate * @generated file - * 20240617.20240620 + * 20240617.20240621 */ import * as OpenAPI from "substrate/OpenAPI"; @@ -52,8 +52,8 @@ export class ComputeTextInImageUris extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `ComputeTextInImageUris` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class ComputeTextInImageUrisItem extends FutureString {} @@ -66,8 +66,8 @@ export class MultiComputeTextOutChoices extends FutureArray { return new ComputeTextOut(this._directive.next(index)); } /** Returns the result for `MultiComputeTextOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Batch input prompts. */ @@ -77,8 +77,8 @@ export class BatchComputeTextInPrompts extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `BatchComputeTextInPrompts` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class BatchComputeTextInPromptsItem extends FutureString {} @@ -89,8 +89,8 @@ export class BatchComputeTextOutOutputs extends FutureArray { return new ComputeTextOut(this._directive.next(index)); } /** Returns the result for `BatchComputeTextOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class MultiComputeJSONInJsonSchema extends FutureAnyObject {} @@ -101,8 +101,8 @@ export class MultiComputeJSONOutChoices extends FutureArray { return new ComputeJSONOut(this._directive.next(index)); } /** Returns the result for `MultiComputeJSONOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Batch input prompts. */ @@ -112,8 +112,8 @@ export class BatchComputeJSONInPrompts extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `BatchComputeJSONInPrompts` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class BatchComputeJSONInPromptsItem extends FutureString {} @@ -125,8 +125,8 @@ export class BatchComputeJSONOutOutputs extends FutureArray { return new ComputeJSONOut(this._directive.next(index)); } /** Returns the result for `BatchComputeJSONOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class Mistral7BInstructInJsonSchema extends FutureAnyObject {} @@ -138,8 +138,8 @@ export class Mistral7BInstructOutChoices extends FutureArray { return new Mistral7BInstructChoice(this._directive.next(index)); } /** Returns the result for `Mistral7BInstructOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class Mixtral8x7BInstructInJsonSchema extends FutureAnyObject {} @@ -151,8 +151,8 @@ export class Mixtral8x7BInstructOutChoices extends FutureArray { return new Mixtral8x7BChoice(this._directive.next(index)); } /** Returns the result for `Mixtral8x7BInstructOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class Llama3Instruct8BInJsonSchema extends FutureAnyObject {} @@ -164,8 +164,8 @@ export class Llama3Instruct8BOutChoices extends FutureArray { return new Llama3Instruct8BChoice(this._directive.next(index)); } /** Returns the result for `Llama3Instruct8BOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Response choices. */ @@ -175,8 +175,8 @@ export class Llama3Instruct70BOutChoices extends FutureArray { return new Llama3Instruct70BChoice(this._directive.next(index)); } /** Returns the result for `Llama3Instruct70BOutChoices` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Image prompts. */ @@ -186,8 +186,8 @@ export class Firellava13BInImageUris extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `Firellava13BInImageUris` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class Firellava13BInImageUrisItem extends FutureString {} @@ -198,8 +198,8 @@ export class MultiGenerateImageOutOutputs extends FutureArray { return new GenerateImageOut(this._directive.next(index)); } /** Returns the result for `MultiGenerateImageOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Seeds for deterministic generation. Default is a random seed. */ @@ -209,8 +209,8 @@ export class StableDiffusionXLInSeeds extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLInSeeds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class StableDiffusionXLInSeedsItem extends FutureNumber {} @@ -221,8 +221,8 @@ export class StableDiffusionXLOutOutputs extends FutureArray { return new StableDiffusionImage(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Seeds for deterministic generation. Default is a random seed. */ @@ -232,8 +232,8 @@ export class StableDiffusionXLLightningInSeeds extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLLightningInSeeds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class StableDiffusionXLLightningInSeedsItem extends FutureNumber {} @@ -244,8 +244,8 @@ export class StableDiffusionXLLightningOutOutputs extends FutureArray { return new StableDiffusionImage(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLLightningOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Random noise seeds. Default is random seeds for each generation. */ @@ -255,8 +255,8 @@ export class StableDiffusionXLIPAdapterInSeeds extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLIPAdapterInSeeds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class StableDiffusionXLIPAdapterInSeedsItem extends FutureNumber {} @@ -267,8 +267,8 @@ export class StableDiffusionXLIPAdapterOutOutputs extends FutureArray { return new StableDiffusionImage(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLIPAdapterOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Random noise seeds. Default is random seeds for each generation. */ @@ -278,8 +278,8 @@ export class StableDiffusionXLControlNetInSeeds extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLControlNetInSeeds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class StableDiffusionXLControlNetInSeedsItem extends FutureNumber {} @@ -290,8 +290,8 @@ export class StableDiffusionXLControlNetOutOutputs extends FutureArray { return new StableDiffusionImage(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLControlNetOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Generated images. */ @@ -301,8 +301,8 @@ export class MultiInpaintImageOutOutputs extends FutureArray { return new InpaintImageOut(this._directive.next(index)); } /** Returns the result for `MultiInpaintImageOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Random noise seeds. Default is random seeds for each generation. */ @@ -312,8 +312,8 @@ export class StableDiffusionXLInpaintInSeeds extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLInpaintInSeeds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class StableDiffusionXLInpaintInSeedsItem extends FutureNumber {} @@ -324,8 +324,8 @@ export class StableDiffusionXLInpaintOutOutputs extends FutureArray { return new StableDiffusionImage(this._directive.next(index)); } /** Returns the result for `StableDiffusionXLInpaintOutOutputs` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Point prompts, to detect a segment under the point. One of `point_prompts` or `box_prompts` must be set. */ @@ -335,8 +335,8 @@ export class SegmentAnythingInPointPrompts extends FutureArray { return new Point(this._directive.next(index)); } /** Returns the result for `SegmentAnythingInPointPrompts` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Box prompts, to detect a segment within the bounding box. One of `point_prompts` or `box_prompts` must be set. */ @@ -346,8 +346,8 @@ export class SegmentAnythingInBoxPrompts extends FutureArray { return new BoundingBox(this._directive.next(index)); } /** Returns the result for `SegmentAnythingInBoxPrompts` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Aligned words, if `align` is enabled. */ @@ -357,8 +357,8 @@ export class TranscribedSegmentWords extends FutureArray { return new TranscribedWord(this._directive.next(index)); } /** Returns the result for `TranscribedSegmentWords` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Transcribed segments, if `segment` is enabled. */ @@ -368,8 +368,8 @@ export class TranscribeSpeechOutSegments extends FutureArray { return new TranscribedSegment(this._directive.next(index)); } /** Returns the result for `TranscribeSpeechOutSegments` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Chapter markers, if `suggest_chapters` is enabled. */ @@ -379,8 +379,8 @@ export class TranscribeSpeechOutChapters extends FutureArray { return new ChapterMarker(this._directive.next(index)); } /** Returns the result for `TranscribeSpeechOutChapters` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Embedding vector. */ @@ -390,8 +390,8 @@ export class EmbeddingVector extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `EmbeddingVector` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class EmbeddingVectorItem extends FutureNumber {} @@ -404,8 +404,8 @@ export class EmbedTextInEmbeddedMetadataKeys extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `EmbedTextInEmbeddedMetadataKeys` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class EmbedTextInEmbeddedMetadataKeysItem extends FutureString {} @@ -417,8 +417,8 @@ export class MultiEmbedTextInItems extends FutureArray { return new EmbedTextItem(this._directive.next(index)); } /** Returns the result for `MultiEmbedTextInItems` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Choose keys from `metadata` to embed with text. */ @@ -428,8 +428,8 @@ export class MultiEmbedTextInEmbeddedMetadataKeys extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `MultiEmbedTextInEmbeddedMetadataKeys` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class MultiEmbedTextInEmbeddedMetadataKeysItem extends FutureString {} @@ -440,8 +440,8 @@ export class MultiEmbedTextOutEmbeddings extends FutureArray { return new Embedding(this._directive.next(index)); } /** Returns the result for `MultiEmbedTextOutEmbeddings` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Items to embed. */ @@ -451,8 +451,8 @@ export class JinaV2InItems extends FutureArray { return new EmbedTextItem(this._directive.next(index)); } /** Returns the result for `JinaV2InItems` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Choose keys from `metadata` to embed with text. */ @@ -462,8 +462,8 @@ export class JinaV2InEmbeddedMetadataKeys extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `JinaV2InEmbeddedMetadataKeys` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class JinaV2InEmbeddedMetadataKeysItem extends FutureString {} @@ -474,8 +474,8 @@ export class JinaV2OutEmbeddings extends FutureArray { return new Embedding(this._directive.next(index)); } /** Returns the result for `JinaV2OutEmbeddings` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class EmbedTextOrImageItemMetadata extends FutureAnyObject {} @@ -486,8 +486,8 @@ export class MultiEmbedImageInItems extends FutureArray { return new EmbedImageItem(this._directive.next(index)); } /** Returns the result for `MultiEmbedImageInItems` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Generated embeddings. */ @@ -497,8 +497,8 @@ export class MultiEmbedImageOutEmbeddings extends FutureArray { return new Embedding(this._directive.next(index)); } /** Returns the result for `MultiEmbedImageOutEmbeddings` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Items to embed. */ @@ -508,8 +508,8 @@ export class CLIPInItems extends FutureArray { return new EmbedTextOrImageItem(this._directive.next(index)); } /** Returns the result for `CLIPInItems` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Choose keys from `metadata` to embed with text. Only applies to text items. */ @@ -519,8 +519,8 @@ export class CLIPInEmbeddedMetadataKeys extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `CLIPInEmbeddedMetadataKeys` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class CLIPInEmbeddedMetadataKeysItem extends FutureString {} @@ -531,8 +531,8 @@ export class CLIPOutEmbeddings extends FutureArray { return new Embedding(this._directive.next(index)); } /** Returns the result for `CLIPOutEmbeddings` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** List of vector stores. */ @@ -542,8 +542,8 @@ export class ListVectorStoresOutItems extends FutureArray { return new FindOrCreateVectorStoreOut(this._directive.next(index)); } /** Returns the result for `ListVectorStoresOutItems` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Embedding vector. */ @@ -553,8 +553,8 @@ export class VectorVector extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `VectorVector` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class VectorVectorItem extends FutureNumber {} @@ -566,8 +566,8 @@ export class FetchVectorsInIds extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `FetchVectorsInIds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class FetchVectorsInIdsItem extends FutureString {} @@ -578,8 +578,8 @@ export class FetchVectorsOutVectors extends FutureArray { return new Vector(this._directive.next(index)); } /** Returns the result for `FetchVectorsOutVectors` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Embedding vector. */ @@ -589,8 +589,8 @@ export class UpdateVectorParamsVector extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `UpdateVectorParamsVector` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class UpdateVectorParamsVectorItem extends FutureNumber {} @@ -602,8 +602,8 @@ export class UpdateVectorsInVectors extends FutureArray { return new UpdateVectorParams(this._directive.next(index)); } /** Returns the result for `UpdateVectorsInVectors` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Document IDs to delete. */ @@ -613,8 +613,8 @@ export class DeleteVectorsInIds extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `DeleteVectorsInIds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class DeleteVectorsInIdsItem extends FutureString {} @@ -625,8 +625,8 @@ export class QueryVectorStoreInQueryStrings extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreInQueryStrings` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class QueryVectorStoreInQueryStringsItem extends FutureString {} @@ -637,8 +637,8 @@ export class QueryVectorStoreInQueryImageUris extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreInQueryImageUris` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class QueryVectorStoreInQueryImageUrisItem extends FutureString {} @@ -649,8 +649,8 @@ export class QueryVectorStoreInQueryVectors extends FutureArray { return new QueryVectorStoreInQueryVectorsItem(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreInQueryVectors` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** QueryVectorStoreInQueryVectorsItem */ @@ -660,8 +660,8 @@ export class QueryVectorStoreInQueryVectorsItem extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreInQueryVectorsItem` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Document IDs to use for the query. */ @@ -671,8 +671,8 @@ export class QueryVectorStoreInQueryIds extends FutureArray { return new FutureString(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreInQueryIds` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class QueryVectorStoreInQueryIdsItem extends FutureString {} @@ -684,8 +684,8 @@ export class VectorStoreQueryResultVector extends FutureArray { return new FutureNumber(this._directive.next(index)); } /** Returns the result for `VectorStoreQueryResultVector` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export class VectorStoreQueryResultVectorItem extends FutureNumber {} @@ -697,8 +697,8 @@ export class QueryVectorStoreOutResults extends FutureArray { return new QueryVectorStoreOutResultsItem(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreOutResults` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** QueryVectorStoreOutResultsItem */ @@ -708,8 +708,8 @@ export class QueryVectorStoreOutResultsItem extends FutureArray { return new VectorStoreQueryResult(this._directive.next(index)); } /** Returns the result for `QueryVectorStoreOutResultsItem` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ErrorOut */ @@ -723,8 +723,8 @@ export class ErrorOut extends FutureObject { return new FutureString(this._directive.next("message")); } /** returns the result for `ErrorOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ExperimentalIn */ @@ -742,8 +742,8 @@ export class ExperimentalIn extends FutureObject { return new FutureNumber(this._directive.next("timeout")); } /** returns the result for `ExperimentalIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ExperimentalOut */ @@ -753,8 +753,62 @@ export class ExperimentalOut extends FutureObject { return new FutureAnyObject(this._directive.next("output")); } /** returns the result for `ExperimentalOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; + } +} +/** BoxIn */ +export class BoxIn extends FutureObject { + /** Values to box. */ + get value() { + return new FutureAnyObject(this._directive.next("value")); + } + /** returns the result for `BoxIn` once it's node has been run. */ + protected override async _result(): Promise { + return super._result() as Promise; + } +} +/** BoxOut */ +export class BoxOut extends FutureObject { + /** The evaluated result. */ + get value() { + return new FutureAnyObject(this._directive.next("value")); + } + /** returns the result for `BoxOut` once it's node has been run. */ + protected override async _result(): Promise { + return super._result() as Promise; + } +} +/** IfIn */ +export class IfIn extends FutureObject { + /** Condition. */ + get condition() { + return new FutureBoolean(this._directive.next("condition")); + } + + /** Result when condition is true. */ + get value_if_true() { + return new FutureAnyObject(this._directive.next("value_if_true")); + } + + /** (Optional) Result when condition is false. */ + get value_if_false() { + return new FutureAnyObject(this._directive.next("value_if_false")); + } + /** returns the result for `IfIn` once it's node has been run. */ + protected override async _result(): Promise { + return super._result() as Promise; + } +} +/** IfOut */ +export class IfOut extends FutureObject { + /** Result. Null if `value_if_false` is not provided and `condition` is false. */ + get result() { + return new FutureAnyObject(this._directive.next("result")); + } + /** returns the result for `IfOut` once it's node has been run. */ + protected override async _result(): Promise { + return super._result() as Promise; } } /** ComputeTextIn */ @@ -781,8 +835,8 @@ export class ComputeTextIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `ComputeTextIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ComputeTextOut */ @@ -792,8 +846,8 @@ export class ComputeTextOut extends FutureObject { return new FutureString(this._directive.next("text")); } /** returns the result for `ComputeTextOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ComputeJSONIn */ @@ -819,8 +873,8 @@ export class ComputeJSONIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `ComputeJSONIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ComputeJSONOut */ @@ -834,8 +888,8 @@ export class ComputeJSONOut extends FutureObject { return new FutureString(this._directive.next("text")); } /** returns the result for `ComputeJSONOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiComputeTextIn */ @@ -861,8 +915,8 @@ export class MultiComputeTextIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `MultiComputeTextIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiComputeTextOut */ @@ -872,8 +926,8 @@ export class MultiComputeTextOut extends FutureObject { return new MultiComputeTextOutChoices(this._directive.next("choices")); } /** returns the result for `MultiComputeTextOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BatchComputeTextIn */ @@ -895,8 +949,8 @@ export class BatchComputeTextIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `BatchComputeTextIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BatchComputeTextOut */ @@ -906,8 +960,8 @@ export class BatchComputeTextOut extends FutureObject { return new BatchComputeTextOutOutputs(this._directive.next("outputs")); } /** returns the result for `BatchComputeTextOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiComputeJSONIn */ @@ -937,8 +991,8 @@ export class MultiComputeJSONIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `MultiComputeJSONIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiComputeJSONOut */ @@ -948,8 +1002,8 @@ export class MultiComputeJSONOut extends FutureObject { return new MultiComputeJSONOutChoices(this._directive.next("choices")); } /** returns the result for `MultiComputeJSONOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BatchComputeJSONIn */ @@ -975,8 +1029,8 @@ export class BatchComputeJSONIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `BatchComputeJSONIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BatchComputeJSONOut */ @@ -986,8 +1040,8 @@ export class BatchComputeJSONOut extends FutureObject { return new BatchComputeJSONOutOutputs(this._directive.next("outputs")); } /** returns the result for `BatchComputeJSONOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mistral7BInstructIn */ @@ -1033,8 +1087,8 @@ export class Mistral7BInstructIn extends FutureObject { return new FutureNumber(this._directive.next("max_tokens")); } /** returns the result for `Mistral7BInstructIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mistral7BInstructChoice */ @@ -1048,8 +1102,8 @@ export class Mistral7BInstructChoice extends FutureObject { return new FutureAnyObject(this._directive.next("json_object")); } /** returns the result for `Mistral7BInstructChoice` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mistral7BInstructOut */ @@ -1059,8 +1113,8 @@ export class Mistral7BInstructOut extends FutureObject { return new Mistral7BInstructOutChoices(this._directive.next("choices")); } /** returns the result for `Mistral7BInstructOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mixtral8x7BInstructIn */ @@ -1106,8 +1160,8 @@ export class Mixtral8x7BInstructIn extends FutureObject { return new FutureNumber(this._directive.next("max_tokens")); } /** returns the result for `Mixtral8x7BInstructIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mixtral8x7BChoice */ @@ -1121,8 +1175,8 @@ export class Mixtral8x7BChoice extends FutureObject { return new FutureAnyObject(this._directive.next("json_object")); } /** returns the result for `Mixtral8x7BChoice` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Mixtral8x7BInstructOut */ @@ -1132,8 +1186,8 @@ export class Mixtral8x7BInstructOut extends FutureObject { return new Mixtral8x7BInstructOutChoices(this._directive.next("choices")); } /** returns the result for `Mixtral8x7BInstructOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct8BIn */ @@ -1179,8 +1233,8 @@ export class Llama3Instruct8BIn extends FutureObject { return new FutureAnyObject(this._directive.next("json_schema")); } /** returns the result for `Llama3Instruct8BIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct8BChoice */ @@ -1194,8 +1248,8 @@ export class Llama3Instruct8BChoice extends FutureObject { return new FutureAnyObject(this._directive.next("json_object")); } /** returns the result for `Llama3Instruct8BChoice` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct8BOut */ @@ -1205,8 +1259,8 @@ export class Llama3Instruct8BOut extends FutureObject { return new Llama3Instruct8BOutChoices(this._directive.next("choices")); } /** returns the result for `Llama3Instruct8BOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct70BIn */ @@ -1248,8 +1302,8 @@ export class Llama3Instruct70BIn extends FutureObject { return new FutureNumber(this._directive.next("max_tokens")); } /** returns the result for `Llama3Instruct70BIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct70BChoice */ @@ -1259,8 +1313,8 @@ export class Llama3Instruct70BChoice extends FutureObject { return new FutureString(this._directive.next("text")); } /** returns the result for `Llama3Instruct70BChoice` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Llama3Instruct70BOut */ @@ -1270,8 +1324,8 @@ export class Llama3Instruct70BOut extends FutureObject { return new Llama3Instruct70BOutChoices(this._directive.next("choices")); } /** returns the result for `Llama3Instruct70BOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Firellava13BIn */ @@ -1290,8 +1344,8 @@ export class Firellava13BIn extends FutureObject { return new FutureNumber(this._directive.next("max_tokens")); } /** returns the result for `Firellava13BIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Firellava13BOut */ @@ -1301,8 +1355,8 @@ export class Firellava13BOut extends FutureObject { return new FutureString(this._directive.next("text")); } /** returns the result for `Firellava13BOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** GenerateImageIn */ @@ -1316,8 +1370,8 @@ export class GenerateImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `GenerateImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** GenerateImageOut */ @@ -1327,8 +1381,8 @@ export class GenerateImageOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `GenerateImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiGenerateImageIn */ @@ -1346,8 +1400,8 @@ export class MultiGenerateImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `MultiGenerateImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiGenerateImageOut */ @@ -1357,8 +1411,8 @@ export class MultiGenerateImageOut extends FutureObject { return new MultiGenerateImageOutOutputs(this._directive.next("outputs")); } /** returns the result for `MultiGenerateImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLIn */ @@ -1401,8 +1455,8 @@ export class StableDiffusionXLIn extends FutureObject { return new FutureNumber(this._directive.next("guidance_scale")); } /** returns the result for `StableDiffusionXLIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionImage */ @@ -1416,8 +1470,8 @@ export class StableDiffusionImage extends FutureObject { return new FutureNumber(this._directive.next("seed")); } /** returns the result for `StableDiffusionImage` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLOut */ @@ -1427,8 +1481,8 @@ export class StableDiffusionXLOut extends FutureObject { return new StableDiffusionXLOutOutputs(this._directive.next("outputs")); } /** returns the result for `StableDiffusionXLOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLLightningIn */ @@ -1463,8 +1517,8 @@ export class StableDiffusionXLLightningIn extends FutureObject { return new StableDiffusionXLLightningInSeeds(this._directive.next("seeds")); } /** returns the result for `StableDiffusionXLLightningIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLLightningOut */ @@ -1476,8 +1530,8 @@ export class StableDiffusionXLLightningOut extends FutureObject { ); } /** returns the result for `StableDiffusionXLLightningOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLIPAdapterIn */ @@ -1520,8 +1574,8 @@ export class StableDiffusionXLIPAdapterIn extends FutureObject { return new StableDiffusionXLIPAdapterInSeeds(this._directive.next("seeds")); } /** returns the result for `StableDiffusionXLIPAdapterIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLIPAdapterOut */ @@ -1533,8 +1587,8 @@ export class StableDiffusionXLIPAdapterOut extends FutureObject { ); } /** returns the result for `StableDiffusionXLIPAdapterOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLControlNetIn */ @@ -1583,8 +1637,8 @@ export class StableDiffusionXLControlNetIn extends FutureObject { ); } /** returns the result for `StableDiffusionXLControlNetIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLControlNetOut */ @@ -1596,8 +1650,8 @@ export class StableDiffusionXLControlNetOut extends FutureObject { ); } /** returns the result for `StableDiffusionXLControlNetOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** InpaintImageIn */ @@ -1619,8 +1673,8 @@ export class InpaintImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `InpaintImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** InpaintImageOut */ @@ -1630,8 +1684,8 @@ export class InpaintImageOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `InpaintImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiInpaintImageIn */ @@ -1657,8 +1711,8 @@ export class MultiInpaintImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `MultiInpaintImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiInpaintImageOut */ @@ -1668,8 +1722,8 @@ export class MultiInpaintImageOut extends FutureObject { return new MultiInpaintImageOutOutputs(this._directive.next("outputs")); } /** returns the result for `MultiInpaintImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLInpaintIn */ @@ -1712,8 +1766,8 @@ export class StableDiffusionXLInpaintIn extends FutureObject { return new StableDiffusionXLInpaintInSeeds(this._directive.next("seeds")); } /** returns the result for `StableDiffusionXLInpaintIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** StableDiffusionXLInpaintOut */ @@ -1725,8 +1779,8 @@ export class StableDiffusionXLInpaintOut extends FutureObject { ); } /** returns the result for `StableDiffusionXLInpaintOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BoundingBox */ @@ -1748,8 +1802,8 @@ export class BoundingBox extends FutureObject { return new FutureNumber(this._directive.next("y2")); } /** returns the result for `BoundingBox` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Point */ @@ -1763,8 +1817,8 @@ export class Point extends FutureObject { return new FutureNumber(this._directive.next("y")); } /** returns the result for `Point` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EraseImageIn */ @@ -1782,8 +1836,8 @@ export class EraseImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `EraseImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EraseImageOut */ @@ -1793,8 +1847,8 @@ export class EraseImageOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `EraseImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BigLaMaIn */ @@ -1812,8 +1866,8 @@ export class BigLaMaIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `BigLaMaIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** BigLaMaOut */ @@ -1823,8 +1877,8 @@ export class BigLaMaOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `BigLaMaOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** RemoveBackgroundIn */ @@ -1846,8 +1900,8 @@ export class RemoveBackgroundIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `RemoveBackgroundIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** RemoveBackgroundOut */ @@ -1857,8 +1911,8 @@ export class RemoveBackgroundOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `RemoveBackgroundOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DISISNetIn */ @@ -1872,8 +1926,8 @@ export class DISISNetIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `DISISNetIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DISISNetOut */ @@ -1883,8 +1937,8 @@ export class DISISNetOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `DISISNetOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** UpscaleImageIn */ @@ -1906,8 +1960,8 @@ export class UpscaleImageIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `UpscaleImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** UpscaleImageOut */ @@ -1917,8 +1971,8 @@ export class UpscaleImageOut extends FutureObject { return new FutureString(this._directive.next("image_uri")); } /** returns the result for `UpscaleImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** SegmentUnderPointIn */ @@ -1936,8 +1990,8 @@ export class SegmentUnderPointIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `SegmentUnderPointIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** SegmentUnderPointOut */ @@ -1947,8 +2001,8 @@ export class SegmentUnderPointOut extends FutureObject { return new FutureString(this._directive.next("mask_image_uri")); } /** returns the result for `SegmentUnderPointOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** SegmentAnythingIn */ @@ -1974,8 +2028,8 @@ export class SegmentAnythingIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `SegmentAnythingIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** SegmentAnythingOut */ @@ -1985,8 +2039,8 @@ export class SegmentAnythingOut extends FutureObject { return new FutureString(this._directive.next("mask_image_uri")); } /** returns the result for `SegmentAnythingOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** TranscribeSpeechIn */ @@ -2020,8 +2074,8 @@ export class TranscribeSpeechIn extends FutureObject { return new FutureBoolean(this._directive.next("suggest_chapters")); } /** returns the result for `TranscribeSpeechIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** TranscribedWord */ @@ -2043,8 +2097,8 @@ export class TranscribedWord extends FutureObject { return new FutureString(this._directive.next("speaker")); } /** returns the result for `TranscribedWord` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** TranscribedSegment */ @@ -2071,8 +2125,8 @@ export class TranscribedSegment extends FutureObject { return new TranscribedSegmentWords(this._directive.next("words")); } /** returns the result for `TranscribedSegment` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ChapterMarker */ @@ -2086,8 +2140,8 @@ export class ChapterMarker extends FutureObject { return new FutureNumber(this._directive.next("start")); } /** returns the result for `ChapterMarker` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** TranscribeSpeechOut */ @@ -2107,8 +2161,8 @@ export class TranscribeSpeechOut extends FutureObject { return new TranscribeSpeechOutChapters(this._directive.next("chapters")); } /** returns the result for `TranscribeSpeechOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** GenerateSpeechIn */ @@ -2122,8 +2176,8 @@ export class GenerateSpeechIn extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `GenerateSpeechIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** GenerateSpeechOut */ @@ -2133,8 +2187,8 @@ export class GenerateSpeechOut extends FutureObject { return new FutureString(this._directive.next("audio_uri")); } /** returns the result for `GenerateSpeechOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** XTTSV2In */ @@ -2156,8 +2210,8 @@ export class XTTSV2In extends FutureObject { return new FutureString(this._directive.next("store")); } /** returns the result for `XTTSV2In` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** XTTSV2Out */ @@ -2167,8 +2221,8 @@ export class XTTSV2Out extends FutureObject { return new FutureString(this._directive.next("audio_uri")); } /** returns the result for `XTTSV2Out` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Embedding */ @@ -2186,8 +2240,8 @@ export class Embedding extends FutureObject { return new FutureAnyObject(this._directive.next("metadata")); } /** returns the result for `Embedding` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedTextIn */ @@ -2220,8 +2274,8 @@ export class EmbedTextIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `EmbedTextIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedTextOut */ @@ -2231,8 +2285,8 @@ export class EmbedTextOut extends FutureObject { return new Embedding(this._directive.next("embedding")); } /** returns the result for `EmbedTextOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedTextItem */ @@ -2250,8 +2304,8 @@ export class EmbedTextItem extends FutureObject { return new FutureString(this._directive.next("doc_id")); } /** returns the result for `EmbedTextItem` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiEmbedTextIn */ @@ -2276,8 +2330,8 @@ export class MultiEmbedTextIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `MultiEmbedTextIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiEmbedTextOut */ @@ -2287,8 +2341,8 @@ export class MultiEmbedTextOut extends FutureObject { return new MultiEmbedTextOutEmbeddings(this._directive.next("embeddings")); } /** returns the result for `MultiEmbedTextOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** JinaV2In */ @@ -2309,8 +2363,8 @@ export class JinaV2In extends FutureObject { ); } /** returns the result for `JinaV2In` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** JinaV2Out */ @@ -2320,8 +2374,8 @@ export class JinaV2Out extends FutureObject { return new JinaV2OutEmbeddings(this._directive.next("embeddings")); } /** returns the result for `JinaV2Out` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedImageIn */ @@ -2343,8 +2397,8 @@ export class EmbedImageIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `EmbedImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedImageOut */ @@ -2354,8 +2408,8 @@ export class EmbedImageOut extends FutureObject { return new Embedding(this._directive.next("embedding")); } /** returns the result for `EmbedImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedImageItem */ @@ -2369,8 +2423,8 @@ export class EmbedImageItem extends FutureObject { return new FutureString(this._directive.next("doc_id")); } /** returns the result for `EmbedImageItem` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** EmbedTextOrImageItem */ @@ -2392,8 +2446,8 @@ export class EmbedTextOrImageItem extends FutureObject { return new FutureString(this._directive.next("doc_id")); } /** returns the result for `EmbedTextOrImageItem` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiEmbedImageIn */ @@ -2411,8 +2465,8 @@ export class MultiEmbedImageIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `MultiEmbedImageIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** MultiEmbedImageOut */ @@ -2422,8 +2476,8 @@ export class MultiEmbedImageOut extends FutureObject { return new MultiEmbedImageOutEmbeddings(this._directive.next("embeddings")); } /** returns the result for `MultiEmbedImageOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** CLIPIn */ @@ -2444,8 +2498,8 @@ export class CLIPIn extends FutureObject { ); } /** returns the result for `CLIPIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** CLIPOut */ @@ -2455,8 +2509,8 @@ export class CLIPOut extends FutureObject { return new CLIPOutEmbeddings(this._directive.next("embeddings")); } /** returns the result for `CLIPOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** FindOrCreateVectorStoreIn */ @@ -2470,8 +2524,8 @@ export class FindOrCreateVectorStoreIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `FindOrCreateVectorStoreIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** FindOrCreateVectorStoreOut */ @@ -2485,15 +2539,15 @@ export class FindOrCreateVectorStoreOut extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `FindOrCreateVectorStoreOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ListVectorStoresIn */ export class ListVectorStoresIn extends FutureObject { /** returns the result for `ListVectorStoresIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** ListVectorStoresOut */ @@ -2503,8 +2557,8 @@ export class ListVectorStoresOut extends FutureObject { return new ListVectorStoresOutItems(this._directive.next("items")); } /** returns the result for `ListVectorStoresOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DeleteVectorStoreIn */ @@ -2518,8 +2572,8 @@ export class DeleteVectorStoreIn extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `DeleteVectorStoreIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DeleteVectorStoreOut */ @@ -2533,8 +2587,8 @@ export class DeleteVectorStoreOut extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `DeleteVectorStoreOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** Canonical representation of document with embedding vector. */ @@ -2553,8 +2607,8 @@ export class Vector extends FutureObject { return new FutureAnyObject(this._directive.next("metadata")); } /** returns the result for `Vector` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** FetchVectorsIn */ @@ -2573,8 +2627,8 @@ export class FetchVectorsIn extends FutureObject { return new FetchVectorsInIds(this._directive.next("ids")); } /** returns the result for `FetchVectorsIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** FetchVectorsOut */ @@ -2584,8 +2638,8 @@ export class FetchVectorsOut extends FutureObject { return new FetchVectorsOutVectors(this._directive.next("vectors")); } /** returns the result for `FetchVectorsOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** UpdateVectorsOut */ @@ -2595,8 +2649,8 @@ export class UpdateVectorsOut extends FutureObject { return new FutureNumber(this._directive.next("count")); } /** returns the result for `UpdateVectorsOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DeleteVectorsOut */ @@ -2606,8 +2660,8 @@ export class DeleteVectorsOut extends FutureObject { return new FutureNumber(this._directive.next("count")); } /** returns the result for `DeleteVectorsOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** UpdateVectorParams */ @@ -2626,8 +2680,8 @@ export class UpdateVectorParams extends FutureObject { return new FutureAnyObject(this._directive.next("metadata")); } /** returns the result for `UpdateVectorParams` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** UpdateVectorsIn */ @@ -2646,8 +2700,8 @@ export class UpdateVectorsIn extends FutureObject { return new UpdateVectorsInVectors(this._directive.next("vectors")); } /** returns the result for `UpdateVectorsIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** DeleteVectorsIn */ @@ -2666,8 +2720,8 @@ export class DeleteVectorsIn extends FutureObject { return new DeleteVectorsInIds(this._directive.next("ids")); } /** returns the result for `DeleteVectorsIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** QueryVectorStoreIn */ @@ -2727,8 +2781,8 @@ export class QueryVectorStoreIn extends FutureObject { return new FutureAnyObject(this._directive.next("filters")); } /** returns the result for `QueryVectorStoreIn` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** VectorStoreQueryResult */ @@ -2751,8 +2805,8 @@ export class VectorStoreQueryResult extends FutureObject { return new FutureAnyObject(this._directive.next("metadata")); } /** returns the result for `VectorStoreQueryResult` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } /** QueryVectorStoreOut */ @@ -2770,8 +2824,8 @@ export class QueryVectorStoreOut extends FutureObject { return new FutureString(this._directive.next("model")); } /** returns the result for `QueryVectorStoreOut` once it's node has been run. */ - protected override async result(): Promise { - return super.result() as Promise; + protected override async _result(): Promise { + return super._result() as Promise; } } export namespace Experimental { @@ -2808,6 +2862,7 @@ export class Experimental extends Node { options?: Options, ) { super(args, options); + this.node = "Experimental"; } /** @@ -2840,6 +2895,136 @@ export class Experimental extends Node { return super.output() as OpenAPI.components["schemas"]["ExperimentalOut"]; } } +export namespace Box { + /** + * Box Input + * https://www.substrate.run/nodes#Box + */ + export type Input = FutureExpandAny; + + /** + * Box Output + * https://www.substrate.run/nodes#Box + */ + export type Output = OpenAPI.components["schemas"]["BoxOut"]; +} + +/** + * Combine multiple values into a single output. + * + * https://www.substrate.run/nodes#Box + */ +export class Box extends Node { + /** + * Input arguments: `value` + * + * Output fields: `value` + * + * https://www.substrate.run/nodes#Box + */ + constructor( + args: FutureExpandAny, + options?: Options, + ) { + super(args, options); + this.node = "Box"; + } + + /** + * Retrieve this node's output from a response. + * + * Output fields: `value` + * + * https://www.substrate.run/nodes#Box + */ + protected override async result(): Promise< + OpenAPI.components["schemas"]["BoxOut"] | undefined + > { + return Promise.resolve( + this._response ? this._response.get(this) : undefined, + ) as Promise; + } + + /** + * Future reference to this node's output. + * + * Output fields: `value` + * + * https://www.substrate.run/nodes#Box + */ + override get future(): BoxOut { + return new BoxOut(new Trace([], this)); + } + + protected override output(): OpenAPI.components["schemas"]["BoxOut"] { + return super.output() as OpenAPI.components["schemas"]["BoxOut"]; + } +} +export namespace If { + /** + * If Input + * https://www.substrate.run/nodes#If + */ + export type Input = FutureExpandAny; + + /** + * If Output + * https://www.substrate.run/nodes#If + */ + export type Output = OpenAPI.components["schemas"]["IfOut"]; +} + +/** + * Return one of two options based on a condition. + * + * https://www.substrate.run/nodes#If + */ +export class If extends Node { + /** + * Input arguments: `condition`, `value_if_true`, `value_if_false` (optional) + * + * Output fields: `result` + * + * https://www.substrate.run/nodes#If + */ + constructor( + args: FutureExpandAny, + options?: Options, + ) { + super(args, options); + this.node = "LogicalIf"; + } + + /** + * Retrieve this node's output from a response. + * + * Output fields: `result` + * + * https://www.substrate.run/nodes#If + */ + protected override async result(): Promise< + OpenAPI.components["schemas"]["IfOut"] | undefined + > { + return Promise.resolve( + this._response ? this._response.get(this) : undefined, + ) as Promise; + } + + /** + * Future reference to this node's output. + * + * Output fields: `result` + * + * https://www.substrate.run/nodes#If + */ + override get future(): IfOut { + return new IfOut(new Trace([], this)); + } + + protected override output(): OpenAPI.components["schemas"]["IfOut"] { + return super.output() as OpenAPI.components["schemas"]["IfOut"]; + } +} export namespace ComputeText { /** * ComputeText Input @@ -2874,6 +3059,7 @@ export class ComputeText extends Node { options?: Options, ) { super(args, options); + this.node = "ComputeText"; } /** @@ -2940,6 +3126,7 @@ export class MultiComputeText extends Node { options?: Options, ) { super(args, options); + this.node = "MultiComputeText"; } /** @@ -3008,6 +3195,7 @@ export class BatchComputeText extends Node { options?: Options, ) { super(args, options); + this.node = "BatchComputeText"; } /** @@ -3076,6 +3264,7 @@ export class BatchComputeJSON extends Node { options?: Options, ) { super(args, options); + this.node = "BatchComputeJSON"; } /** @@ -3144,6 +3333,7 @@ export class ComputeJSON extends Node { options?: Options, ) { super(args, options); + this.node = "ComputeJSON"; } /** @@ -3210,6 +3400,7 @@ export class MultiComputeJSON extends Node { options?: Options, ) { super(args, options); + this.node = "MultiComputeJSON"; } /** @@ -3278,6 +3469,7 @@ export class Mistral7BInstruct extends Node { options?: Options, ) { super(args, options); + this.node = "Mistral7BInstruct"; } /** @@ -3348,6 +3540,7 @@ export class Mixtral8x7BInstruct extends Node { options?: Options, ) { super(args, options); + this.node = "Mixtral8x7BInstruct"; } /** @@ -3416,6 +3609,7 @@ export class Llama3Instruct8B extends Node { options?: Options, ) { super(args, options); + this.node = "Llama3Instruct8B"; } /** @@ -3484,6 +3678,7 @@ export class Llama3Instruct70B extends Node { options?: Options, ) { super(args, options); + this.node = "Llama3Instruct70B"; } /** @@ -3552,6 +3747,7 @@ export class Firellava13B extends Node { options?: Options, ) { super(args, options); + this.node = "Firellava13B"; } /** @@ -3618,6 +3814,7 @@ export class GenerateImage extends Node { options?: Options, ) { super(args, options); + this.node = "GenerateImage"; } /** @@ -3686,6 +3883,7 @@ export class MultiGenerateImage extends Node { options?: Options, ) { super(args, options); + this.node = "MultiGenerateImage"; } /** @@ -3754,6 +3952,7 @@ export class InpaintImage extends Node { options?: Options, ) { super(args, options); + this.node = "InpaintImage"; } /** @@ -3820,6 +4019,7 @@ export class MultiInpaintImage extends Node { options?: Options, ) { super(args, options); + this.node = "MultiInpaintImage"; } /** @@ -3891,6 +4091,7 @@ export class StableDiffusionXLLightning extends Node { options?: Options, ) { super(args, options); + this.node = "StableDiffusionXLLightning"; } /** @@ -3962,6 +4163,7 @@ export class StableDiffusionXLInpaint extends Node { options?: Options, ) { super(args, options); + this.node = "StableDiffusionXLInpaint"; } /** @@ -4033,6 +4235,7 @@ export class StableDiffusionXLControlNet extends Node { options?: Options, ) { super(args, options); + this.node = "StableDiffusionXLControlNet"; } /** @@ -4102,6 +4305,7 @@ export class TranscribeSpeech extends Node { options?: Options, ) { super(args, options); + this.node = "TranscribeSpeech"; } /** @@ -4170,6 +4374,7 @@ export class GenerateSpeech extends Node { options?: Options, ) { super(args, options); + this.node = "GenerateSpeech"; } /** @@ -4238,6 +4443,7 @@ export class RemoveBackground extends Node { options?: Options, ) { super(args, options); + this.node = "RemoveBackground"; } /** @@ -4306,6 +4512,7 @@ export class EraseImage extends Node { options?: Options, ) { super(args, options); + this.node = "EraseImage"; } /** @@ -4372,6 +4579,7 @@ export class UpscaleImage extends Node { options?: Options, ) { super(args, options); + this.node = "UpscaleImage"; } /** @@ -4438,6 +4646,7 @@ export class SegmentUnderPoint extends Node { options?: Options, ) { super(args, options); + this.node = "SegmentUnderPoint"; } /** @@ -4506,6 +4715,7 @@ export class SegmentAnything extends Node { options?: Options, ) { super(args, options); + this.node = "SegmentAnything"; } /** @@ -4574,6 +4784,7 @@ export class EmbedText extends Node { options?: Options, ) { super(args, options); + this.node = "EmbedText"; } /** @@ -4640,6 +4851,7 @@ export class MultiEmbedText extends Node { options?: Options, ) { super(args, options); + this.node = "MultiEmbedText"; } /** @@ -4708,6 +4920,7 @@ export class EmbedImage extends Node { options?: Options, ) { super(args, options); + this.node = "EmbedImage"; } /** @@ -4774,6 +4987,7 @@ export class MultiEmbedImage extends Node { options?: Options, ) { super(args, options); + this.node = "MultiEmbedImage"; } /** @@ -4842,6 +5056,7 @@ export class JinaV2 extends Node { options?: Options, ) { super(args, options); + this.node = "JinaV2"; } /** @@ -4906,6 +5121,7 @@ export class CLIP extends Node { options?: Options, ) { super(args, options); + this.node = "CLIP"; } /** @@ -4975,6 +5191,7 @@ export class FindOrCreateVectorStore extends Node { options?: Options, ) { super(args, options); + this.node = "FindOrCreateVectorStore"; } /** @@ -5043,6 +5260,7 @@ export class ListVectorStores extends Node { options?: Options, ) { super(args, options); + this.node = "ListVectorStores"; } /** @@ -5111,6 +5329,7 @@ export class DeleteVectorStore extends Node { options?: Options, ) { super(args, options); + this.node = "DeleteVectorStore"; } /** @@ -5179,6 +5398,7 @@ export class QueryVectorStore extends Node { options?: Options, ) { super(args, options); + this.node = "QueryVectorStore"; } /** @@ -5247,6 +5467,7 @@ export class FetchVectors extends Node { options?: Options, ) { super(args, options); + this.node = "FetchVectors"; } /** @@ -5313,6 +5534,7 @@ export class UpdateVectors extends Node { options?: Options, ) { super(args, options); + this.node = "UpdateVectors"; } /** @@ -5379,6 +5601,7 @@ export class DeleteVectors extends Node { options?: Options, ) { super(args, options); + this.node = "DeleteVectors"; } /** @@ -5413,6 +5636,8 @@ export class DeleteVectors extends Node { } export type AnyNode = | Experimental + | Box + | If | ComputeText | MultiComputeText | BatchComputeText @@ -5454,80 +5679,84 @@ export type AnyNode = export type NodeOutput = T extends Experimental ? OpenAPI.components["schemas"]["ExperimentalOut"] - : T extends ComputeText - ? OpenAPI.components["schemas"]["ComputeTextOut"] - : T extends MultiComputeText - ? OpenAPI.components["schemas"]["MultiComputeTextOut"] - : T extends BatchComputeText - ? OpenAPI.components["schemas"]["BatchComputeTextOut"] - : T extends BatchComputeJSON - ? OpenAPI.components["schemas"]["BatchComputeJSONOut"] - : T extends ComputeJSON - ? OpenAPI.components["schemas"]["ComputeJSONOut"] - : T extends MultiComputeJSON - ? OpenAPI.components["schemas"]["MultiComputeJSONOut"] - : T extends Mistral7BInstruct - ? OpenAPI.components["schemas"]["Mistral7BInstructOut"] - : T extends Mixtral8x7BInstruct - ? OpenAPI.components["schemas"]["Mixtral8x7BInstructOut"] - : T extends Llama3Instruct8B - ? OpenAPI.components["schemas"]["Llama3Instruct8BOut"] - : T extends Llama3Instruct70B - ? OpenAPI.components["schemas"]["Llama3Instruct70BOut"] - : T extends Firellava13B - ? OpenAPI.components["schemas"]["Firellava13BOut"] - : T extends GenerateImage - ? OpenAPI.components["schemas"]["GenerateImageOut"] - : T extends MultiGenerateImage - ? OpenAPI.components["schemas"]["MultiGenerateImageOut"] - : T extends InpaintImage - ? OpenAPI.components["schemas"]["InpaintImageOut"] - : T extends MultiInpaintImage - ? OpenAPI.components["schemas"]["MultiInpaintImageOut"] - : T extends StableDiffusionXLLightning - ? OpenAPI.components["schemas"]["StableDiffusionXLLightningOut"] - : T extends StableDiffusionXLInpaint - ? OpenAPI.components["schemas"]["StableDiffusionXLInpaintOut"] - : T extends StableDiffusionXLControlNet - ? OpenAPI.components["schemas"]["StableDiffusionXLControlNetOut"] - : T extends TranscribeSpeech - ? OpenAPI.components["schemas"]["TranscribeSpeechOut"] - : T extends GenerateSpeech - ? OpenAPI.components["schemas"]["GenerateSpeechOut"] - : T extends RemoveBackground - ? OpenAPI.components["schemas"]["RemoveBackgroundOut"] - : T extends EraseImage - ? OpenAPI.components["schemas"]["EraseImageOut"] - : T extends UpscaleImage - ? OpenAPI.components["schemas"]["UpscaleImageOut"] - : T extends SegmentUnderPoint - ? OpenAPI.components["schemas"]["SegmentUnderPointOut"] - : T extends SegmentAnything - ? OpenAPI.components["schemas"]["SegmentAnythingOut"] - : T extends EmbedText - ? OpenAPI.components["schemas"]["EmbedTextOut"] - : T extends MultiEmbedText - ? OpenAPI.components["schemas"]["MultiEmbedTextOut"] - : T extends EmbedImage - ? OpenAPI.components["schemas"]["EmbedImageOut"] - : T extends MultiEmbedImage - ? OpenAPI.components["schemas"]["MultiEmbedImageOut"] - : T extends JinaV2 - ? OpenAPI.components["schemas"]["JinaV2Out"] - : T extends CLIP - ? OpenAPI.components["schemas"]["CLIPOut"] - : T extends FindOrCreateVectorStore - ? OpenAPI.components["schemas"]["FindOrCreateVectorStoreOut"] - : T extends ListVectorStores - ? OpenAPI.components["schemas"]["ListVectorStoresOut"] - : T extends DeleteVectorStore - ? OpenAPI.components["schemas"]["DeleteVectorStoreOut"] - : T extends QueryVectorStore - ? OpenAPI.components["schemas"]["QueryVectorStoreOut"] - : T extends FetchVectors - ? OpenAPI.components["schemas"]["FetchVectorsOut"] - : T extends UpdateVectors - ? OpenAPI.components["schemas"]["UpdateVectorsOut"] - : T extends DeleteVectors - ? OpenAPI.components["schemas"]["DeleteVectorsOut"] - : never; + : T extends Box + ? OpenAPI.components["schemas"]["BoxOut"] + : T extends If + ? OpenAPI.components["schemas"]["IfOut"] + : T extends ComputeText + ? OpenAPI.components["schemas"]["ComputeTextOut"] + : T extends MultiComputeText + ? OpenAPI.components["schemas"]["MultiComputeTextOut"] + : T extends BatchComputeText + ? OpenAPI.components["schemas"]["BatchComputeTextOut"] + : T extends BatchComputeJSON + ? OpenAPI.components["schemas"]["BatchComputeJSONOut"] + : T extends ComputeJSON + ? OpenAPI.components["schemas"]["ComputeJSONOut"] + : T extends MultiComputeJSON + ? OpenAPI.components["schemas"]["MultiComputeJSONOut"] + : T extends Mistral7BInstruct + ? OpenAPI.components["schemas"]["Mistral7BInstructOut"] + : T extends Mixtral8x7BInstruct + ? OpenAPI.components["schemas"]["Mixtral8x7BInstructOut"] + : T extends Llama3Instruct8B + ? OpenAPI.components["schemas"]["Llama3Instruct8BOut"] + : T extends Llama3Instruct70B + ? OpenAPI.components["schemas"]["Llama3Instruct70BOut"] + : T extends Firellava13B + ? OpenAPI.components["schemas"]["Firellava13BOut"] + : T extends GenerateImage + ? OpenAPI.components["schemas"]["GenerateImageOut"] + : T extends MultiGenerateImage + ? OpenAPI.components["schemas"]["MultiGenerateImageOut"] + : T extends InpaintImage + ? OpenAPI.components["schemas"]["InpaintImageOut"] + : T extends MultiInpaintImage + ? OpenAPI.components["schemas"]["MultiInpaintImageOut"] + : T extends StableDiffusionXLLightning + ? OpenAPI.components["schemas"]["StableDiffusionXLLightningOut"] + : T extends StableDiffusionXLInpaint + ? OpenAPI.components["schemas"]["StableDiffusionXLInpaintOut"] + : T extends StableDiffusionXLControlNet + ? OpenAPI.components["schemas"]["StableDiffusionXLControlNetOut"] + : T extends TranscribeSpeech + ? OpenAPI.components["schemas"]["TranscribeSpeechOut"] + : T extends GenerateSpeech + ? OpenAPI.components["schemas"]["GenerateSpeechOut"] + : T extends RemoveBackground + ? OpenAPI.components["schemas"]["RemoveBackgroundOut"] + : T extends EraseImage + ? OpenAPI.components["schemas"]["EraseImageOut"] + : T extends UpscaleImage + ? OpenAPI.components["schemas"]["UpscaleImageOut"] + : T extends SegmentUnderPoint + ? OpenAPI.components["schemas"]["SegmentUnderPointOut"] + : T extends SegmentAnything + ? OpenAPI.components["schemas"]["SegmentAnythingOut"] + : T extends EmbedText + ? OpenAPI.components["schemas"]["EmbedTextOut"] + : T extends MultiEmbedText + ? OpenAPI.components["schemas"]["MultiEmbedTextOut"] + : T extends EmbedImage + ? OpenAPI.components["schemas"]["EmbedImageOut"] + : T extends MultiEmbedImage + ? OpenAPI.components["schemas"]["MultiEmbedImageOut"] + : T extends JinaV2 + ? OpenAPI.components["schemas"]["JinaV2Out"] + : T extends CLIP + ? OpenAPI.components["schemas"]["CLIPOut"] + : T extends FindOrCreateVectorStore + ? OpenAPI.components["schemas"]["FindOrCreateVectorStoreOut"] + : T extends ListVectorStores + ? OpenAPI.components["schemas"]["ListVectorStoresOut"] + : T extends DeleteVectorStore + ? OpenAPI.components["schemas"]["DeleteVectorStoreOut"] + : T extends QueryVectorStore + ? OpenAPI.components["schemas"]["QueryVectorStoreOut"] + : T extends FetchVectors + ? OpenAPI.components["schemas"]["FetchVectorsOut"] + : T extends UpdateVectors + ? OpenAPI.components["schemas"]["UpdateVectorsOut"] + : T extends DeleteVectors + ? OpenAPI.components["schemas"]["DeleteVectorsOut"] + : never; diff --git a/src/OpenAPI.ts b/src/OpenAPI.ts index d227f83..1bf2b07 100644 --- a/src/OpenAPI.ts +++ b/src/OpenAPI.ts @@ -11,6 +11,20 @@ export interface paths { */ post: operations["Experimental"]; }; + "/Box": { + /** + * Box + * @description Combine multiple values into a single output. + */ + post: operations["Box"]; + }; + "/If": { + /** + * If + * @description Return one of two options based on a condition. + */ + post: operations["If"]; + }; "/RunPython": { /** * RunPython @@ -321,6 +335,30 @@ export interface components { [key: string]: unknown; }; }; + /** BoxIn */ + BoxIn: { + /** @description Values to box. */ + value: unknown; + }; + /** BoxOut */ + BoxOut: { + /** @description The evaluated result. */ + value: unknown; + }; + /** IfIn */ + IfIn: { + /** @description Condition. */ + condition: boolean; + /** @description Result when condition is true. */ + value_if_true: unknown; + /** @description Result when condition is false. */ + value_if_false?: unknown; + }; + /** IfOut */ + IfOut: { + /** @description Result. Null if `value_if_false` is not provided and `condition` is false. */ + result: unknown; + }; /** RunPythonIn */ RunPythonIn: { /** @description Pickled function. */ @@ -1991,6 +2029,81 @@ export interface operations { }; }; }; + /** + * Box + * @description Combine multiple values into a single output. + */ + Box: { + requestBody?: { + content: { + /** + * @example { + * "value": { + * "a": "b", + * "c": { + * "d": [ + * 1, + * 2, + * 3 + * ] + * } + * } + * } + */ + "application/json": { + /** @description Values to box. */ + value: unknown; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + content: { + "application/json": { + /** @description The evaluated result. */ + value: unknown; + }; + }; + }; + }; + }; + /** + * If + * @description Return one of two options based on a condition. + */ + If: { + requestBody?: { + content: { + /** + * @example { + * "condition": true, + * "value_if_true": "yes", + * "value_if_false": "no" + * } + */ + "application/json": { + /** @description Condition. */ + condition: boolean; + /** @description Result when condition is true. */ + value_if_true: unknown; + /** @description Result when condition is false. */ + value_if_false?: unknown; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + content: { + "application/json": { + /** @description Result. Null if `value_if_false` is not provided and `condition` is false. */ + result: unknown; + }; + }; + }; + }; + }; /** * RunPython * @description Run code using a Python interpreter. diff --git a/src/index.ts b/src/index.ts index ec8bb27..1c4d49d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,14 @@ /** * 𐃏 Substrate TypeScript SDK * @generated file - * 20240617.20240620 + * 20240617.20240621 */ export { SubstrateError } from "substrate/Error"; export { Experimental, + Box, + If, ComputeText, MultiComputeText, BatchComputeText, diff --git a/src/openapi.json b/src/openapi.json index a6c953c..5e4f29b 100644 --- a/src/openapi.json +++ b/src/openapi.json @@ -68,6 +68,58 @@ }, "required": ["output"] }, + "BoxIn": { + "title": "BoxIn", + "type": "object", + "properties": { + "value": { + "description": "Values to box.", + "x-loggable": false + } + }, + "required": ["value"] + }, + "BoxOut": { + "title": "BoxOut", + "type": "object", + "properties": { + "value": { + "description": "The evaluated result.", + "x-loggable": false + } + }, + "required": ["value"] + }, + "IfIn": { + "title": "IfIn", + "type": "object", + "properties": { + "condition": { + "type": "boolean", + "description": "Condition.", + "x-loggable": true + }, + "value_if_true": { + "description": "Result when condition is true.", + "x-loggable": false + }, + "value_if_false": { + "description": "Result when condition is false.", + "x-loggable": false + } + }, + "required": ["condition", "value_if_true"] + }, + "IfOut": { + "title": "IfOut", + "type": "object", + "properties": { + "result": { + "description": "Result. Null if `value_if_false` is not provided and `condition` is false." + } + }, + "required": ["result"] + }, "RunPythonIn": { "title": "RunPythonIn", "type": "object", @@ -2690,6 +2742,89 @@ } } }, + "/Box": { + "post": { + "summary": "Box", + "operationId": "Box", + "tags": ["category:utility"], + "description": "Combine multiple values into a single output.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BoxIn" + }, + "example": { + "value": { + "a": "b", + "c": { + "d": [1, 2, 3] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BoxOut" + }, + "example": { + "value": { + "a": "b", + "c": { + "d": [1, 2, 3] + } + } + } + } + } + } + } + } + }, + "/If": { + "post": { + "summary": "If", + "operationId": "If", + "x-node": "LogicalIf", + "tags": ["category:utility"], + "description": "Return one of two options based on a condition.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IfIn" + }, + "example": { + "condition": true, + "value_if_true": "yes", + "value_if_false": "no" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IfOut" + }, + "example": { + "result": "yes" + } + } + } + } + } + } + }, "/RunPython": { "post": { "summary": "RunPython", diff --git a/src/version.ts b/src/version.ts index 114b0d1..b547e74 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = "120240617.0.1"; +export const VERSION = "120240617.0.2"; diff --git a/tests/Future.test.ts b/tests/Future.test.ts index f4d465e..9ca2251 100644 --- a/tests/Future.test.ts +++ b/tests/Future.test.ts @@ -12,7 +12,7 @@ import { import { Node } from "substrate/Node"; import { SubstrateResponse } from "substrate/SubstrateResponse"; -class FooFuture extends Future {} +class FooFuture extends Future {} class FooNode extends Node {} const node = (id: string = "") => new FooNode({}, { id }); @@ -178,14 +178,16 @@ describe("Future", () => { const i1 = FutureString.interpolate`hello ${world}, you look ${nice} today.`; // @ts-expect-error - expect(i1.result()).resolves.toEqual("hello world, you look nice today."); + expect(i1._result()).resolves.toEqual( + "hello world, you look nice today.", + ); const f1 = FutureString.concat("texas", " ", "sun"); const f2 = FutureString.concat("texas", " ", "moon"); const i2 = FutureString.interpolate`~~ ${f1} x ${f2} ~~`; // @ts-expect-error - expect(i2.result()).resolves.toEqual("~~ texas sun x texas moon ~~"); + expect(i2._result()).resolves.toEqual("~~ texas sun x texas moon ~~"); }); }); });