@opencode/ai 2.2.5 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -72
- package/dist/ai-client.d.ts +2 -2
- package/dist/ai-client.js +2 -1
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +16 -4
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +30 -125
- package/dist/decision.js +27 -15
- package/dist/effect.d.ts +10 -15
- package/dist/effect.js +6 -6
- package/dist/effort-updates.d.ts +3 -3
- package/dist/effort-updates.js +2 -2
- package/dist/embedding-client.d.ts +21 -0
- package/dist/embedding-client.js +30 -0
- package/dist/embedding.d.ts +111 -0
- package/dist/embedding.js +75 -0
- package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
- package/dist/experimental/cloudflare-run-extraction.js +4 -1
- package/dist/experimental/extraction.d.ts +10 -40
- package/dist/experimental/extraction.js +14 -13
- package/dist/experimental.d.ts +8 -8
- package/dist/experimental.js +4 -4
- package/dist/generation.d.ts +0 -2
- package/dist/generation.js +2 -2
- package/dist/image-client.d.ts +13 -7
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +357 -465
- package/dist/image.js +17 -18
- package/dist/index.d.ts +35 -467
- package/dist/index.js +23 -17
- package/dist/llm.d.ts +65 -266
- package/dist/llm.js +101 -92
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +136 -0
- package/dist/media-model.d.ts +1 -1
- package/dist/media-model.js +8 -6
- package/dist/media.d.ts +9 -0
- package/dist/media.js +37 -2
- package/dist/protocols/alibaba-chat.d.ts +9 -1
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-images.d.ts +2 -2
- package/dist/protocols/alibaba-messages.js +3 -3
- package/dist/protocols/alibaba-responses.js +8 -20
- package/dist/protocols/anthropic-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.js +57 -176
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/bedrock-converse.js +10 -16
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
- package/dist/protocols/cohere-chat.js +9 -12
- package/dist/protocols/deepgram-speech.d.ts +2 -2
- package/dist/protocols/deepgram-transcription.d.ts +2 -2
- package/dist/protocols/elevenlabs-speech.d.ts +2 -2
- package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
- package/dist/protocols/gemini.d.ts +3 -0
- package/dist/protocols/gemini.js +54 -72
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-interactions.d.ts +3 -4
- package/dist/protocols/google-interactions.js +44 -30
- package/dist/protocols/google-speech.d.ts +2 -2
- package/dist/protocols/google-transcription.d.ts +2 -2
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/meta-images.d.ts +2 -2
- package/dist/protocols/meta-responses.js +26 -23
- package/dist/protocols/minimax-images.d.ts +2 -2
- package/dist/protocols/mistral-chat.js +7 -10
- package/dist/protocols/open-responses-channel.js +6 -19
- package/dist/protocols/open-responses-continuation.d.ts +1 -5
- package/dist/protocols/open-responses-continuation.js +1 -3
- package/dist/protocols/open-responses.d.ts +2 -22
- package/dist/protocols/open-responses.js +41 -23
- package/dist/protocols/openai-chat.d.ts +27 -23
- package/dist/protocols/openai-chat.js +62 -57
- package/dist/protocols/openai-compatible-chat.d.ts +2 -1
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-compatible-responses.js +1 -1
- package/dist/protocols/openai-decisions.js +15 -2
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/openai-images.d.ts +2 -2
- package/dist/protocols/openai-responses.js +10 -29
- package/dist/protocols/openai-speech.d.ts +2 -2
- package/dist/protocols/openai-transcription.d.ts +2 -2
- package/dist/protocols/runway-video.d.ts +2 -2
- package/dist/protocols/shared.d.ts +14 -7
- package/dist/protocols/shared.js +40 -15
- package/dist/protocols/system-one.d.ts +4 -4
- package/dist/protocols/system-one.js +8 -1
- package/dist/protocols/utils/bedrock-cache.js +2 -5
- package/dist/protocols/utils/bedrock-media.d.ts +0 -3
- package/dist/protocols/utils/cache.d.ts +3 -0
- package/dist/protocols/utils/cache.js +15 -2
- package/dist/protocols/utils/image-sizing.d.ts +1 -1
- package/dist/protocols/utils/responses-checkpoint.js +1 -1
- package/dist/protocols/utils/responses-compaction.d.ts +1 -1
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
- package/dist/protocols/utils/responses-hosted-tools.js +31 -0
- package/dist/protocols/utils/tool-stream.d.ts +5 -271
- package/dist/protocols/utils/tool-stream.js +3 -13
- package/dist/protocols/venice-chat.d.ts +7 -1
- package/dist/protocols/venice-chat.js +4 -4
- package/dist/protocols/xai-images.d.ts +2 -2
- package/dist/protocols/xai-responses.js +5 -25
- package/dist/protocols/xai-video.d.ts +2 -2
- package/dist/protocols/zai-chat.d.ts +9 -1
- package/dist/protocols/zai-chat.js +1 -1
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-messages.js +3 -3
- package/dist/provider-error.d.ts +0 -1
- package/dist/provider-error.js +7 -80
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba.d.ts +70 -4
- package/dist/providers/alibaba.js +20 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +7 -3
- package/dist/providers/amazon-bedrock-mantle.js +6 -3
- package/dist/providers/amazon-bedrock.d.ts +6 -7
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +7 -8
- package/dist/providers/anthropic-compatible.js +2 -5
- package/dist/providers/anthropic.d.ts +8 -9
- package/dist/providers/anthropic.js +2 -7
- package/dist/providers/assemblyai.d.ts +2 -2
- package/dist/providers/assemblyai.js +2 -7
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure.d.ts +325 -7
- package/dist/providers/azure.js +40 -9
- package/dist/providers/baseten.d.ts +7 -5
- package/dist/providers/baseten.js +7 -21
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +7 -5
- package/dist/providers/cerebras.js +4 -15
- package/dist/providers/cloudflare-ai-gateway.d.ts +23 -13
- package/dist/providers/cloudflare-ai-gateway.js +28 -40
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +6 -4
- package/dist/providers/cloudflare-workers-ai.js +4 -20
- package/dist/providers/cohere/chat.js +2 -7
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +14 -5
- package/dist/providers/cohere.js +23 -13
- package/dist/providers/deepgram.d.ts +2 -2
- package/dist/providers/deepgram.js +2 -7
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +10 -5
- package/dist/providers/deepinfra.js +20 -14
- package/dist/providers/deepseek.d.ts +7 -5
- package/dist/providers/deepseek.js +3 -14
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean.d.ts +18 -5
- package/dist/providers/digitalocean.js +28 -14
- package/dist/providers/elevenlabs.d.ts +2 -2
- package/dist/providers/elevenlabs.js +2 -7
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +10 -5
- package/dist/providers/fireworks.js +17 -14
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +2 -7
- package/dist/providers/google-vertex/embeddings.d.ts +2 -0
- package/dist/providers/google-vertex/embeddings.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +4 -3
- package/dist/providers/google-vertex-chat.js +3 -29
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +3 -3
- package/dist/providers/google-vertex-messages.js +3 -29
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-mistral.js +3 -29
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google-vertex-responses.js +4 -30
- package/dist/providers/google-vertex-shared.d.ts +31 -0
- package/dist/providers/google-vertex-shared.js +25 -0
- package/dist/providers/google-vertex.d.ts +10 -3
- package/dist/providers/google-vertex.js +52 -0
- package/dist/providers/google.d.ts +21 -13
- package/dist/providers/google.js +23 -19
- package/dist/providers/groq.d.ts +10 -5
- package/dist/providers/groq.js +4 -15
- package/dist/providers/meta.d.ts +6 -5
- package/dist/providers/meta.js +10 -23
- package/dist/providers/minimax/chat.js +2 -7
- package/dist/providers/minimax/responses.js +2 -7
- package/dist/providers/minimax.d.ts +6 -5
- package/dist/providers/minimax.js +7 -22
- package/dist/providers/mistral.d.ts +10 -11
- package/dist/providers/mistral.js +3 -14
- package/dist/providers/moonshot/messages.js +2 -7
- package/dist/providers/moonshot/responses.js +2 -7
- package/dist/providers/moonshot.d.ts +6 -5
- package/dist/providers/moonshot.js +4 -16
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.js +1 -0
- package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
- package/dist/providers/openai-compatible/embeddings.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +6 -7
- package/dist/providers/openai-compatible-responses.js +2 -8
- package/dist/providers/openai-compatible.d.ts +10 -7
- package/dist/providers/openai-compatible.js +17 -10
- package/dist/providers/openai.d.ts +11 -4
- package/dist/providers/openai.js +17 -3
- package/dist/providers/opencode.d.ts +4 -4
- package/dist/providers/opencode.js +6 -2
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter.d.ts +24 -5
- package/dist/providers/openrouter.js +31 -24
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +19 -0
- package/dist/providers/togetherai.d.ts +7 -5
- package/dist/providers/togetherai.js +5 -15
- package/dist/providers/typesafe-ai.d.ts +4 -4
- package/dist/providers/typesafe-ai.js +6 -2
- package/dist/providers/venice.d.ts +5 -4
- package/dist/providers/venice.js +6 -2
- package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +9 -5
- package/dist/providers/vercel-ai-gateway.js +30 -29
- package/dist/providers/xai.d.ts +5 -4
- package/dist/providers/xai.js +4 -12
- package/dist/providers/zai-coding-plan/messages.js +2 -7
- package/dist/providers/zai-coding-plan/responses.js +2 -7
- package/dist/providers/zai-coding-plan.d.ts +6 -5
- package/dist/providers/zai-coding-plan.js +8 -15
- package/dist/providers/zai.d.ts +6 -5
- package/dist/providers/zai.js +10 -22
- package/dist/public.d.ts +14 -0
- package/dist/public.js +6 -0
- package/dist/route/auth-options.d.ts +9 -5
- package/dist/route/auth-options.js +10 -7
- package/dist/route/client.d.ts +50 -37
- package/dist/route/client.js +42 -53
- package/dist/route/decision.d.ts +8 -8
- package/dist/route/decision.js +3 -3
- package/dist/route/embedding.d.ts +61 -0
- package/dist/route/embedding.js +88 -0
- package/dist/route/executor.d.ts +5 -0
- package/dist/route/executor.js +10 -0
- package/dist/route/index.d.ts +5 -7
- package/dist/route/index.js +1 -1
- package/dist/route/media.d.ts +7 -11
- package/dist/route/media.js +22 -26
- package/dist/route/transport/http.js +6 -5
- package/dist/route/transport/websocket.js +7 -1
- package/dist/schema/errors.d.ts +16 -17
- package/dist/schema/errors.js +63 -12
- package/dist/schema/events.d.ts +2563 -2954
- package/dist/schema/events.js +54 -109
- package/dist/schema/messages.d.ts +194 -137
- package/dist/schema/messages.js +66 -83
- package/dist/schema/options.d.ts +112 -65
- package/dist/schema/options.js +52 -101
- package/dist/speech-client.d.ts +7 -7
- package/dist/speech.d.ts +306 -316
- package/dist/speech.js +16 -14
- package/dist/testing.d.ts +31 -175
- package/dist/testing.js +60 -5
- package/dist/tool-history.d.ts +1 -1
- package/dist/tool-history.js +3 -10
- package/dist/tool-runtime.d.ts +9 -2
- package/dist/tool-runtime.js +17 -31
- package/dist/tool.d.ts +39 -43
- package/dist/tool.js +16 -26
- package/dist/transcription-client.d.ts +7 -7
- package/dist/transcription.d.ts +314 -265
- package/dist/transcription.js +16 -14
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/video-client.d.ts +7 -7
- package/dist/video-client.js +1 -1
- package/dist/video.d.ts +269 -287
- package/dist/video.js +16 -14
- package/package.json +309 -257
- package/dist/experimental/testing.d.ts +0 -3
- package/dist/experimental/testing.js +0 -3
- package/dist/testing/decision.d.ts +0 -16
- package/dist/testing/decision.js +0 -20
- package/dist/testing/image.d.ts +0 -14
- package/dist/testing/image.js +0 -12
- package/dist/testing/media.d.ts +0 -18
- package/dist/testing/media.js +0 -36
- package/dist/testing/script.d.ts +0 -28
- package/dist/testing/script.js +0 -60
- package/dist/testing/speech.d.ts +0 -14
- package/dist/testing/speech.js +0 -12
- package/dist/testing/transcription.d.ts +0 -14
- package/dist/testing/transcription.js +0 -12
- package/dist/testing/video.d.ts +0 -14
- package/dist/testing/video.js +0 -12
package/dist/image.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Generation, ProgressEvent, QueuedEvent } from "./generation.js";
|
|
|
3
3
|
import { Media } from "./media.js";
|
|
4
4
|
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
5
5
|
import { MediaRoute } from "./route/media.js";
|
|
6
|
-
import { AIError,
|
|
6
|
+
import { AIError, MediaUsage, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
|
|
7
7
|
import { ImageClient, Service } from "./image-client.js";
|
|
8
8
|
export class ImageModel extends MediaModel {
|
|
9
9
|
static fromRoute(route, input) {
|
|
@@ -20,18 +20,15 @@ export const ImageModelSchema = Schema.declare((value) => value instanceof Image
|
|
|
20
20
|
expected: "Image.Model",
|
|
21
21
|
});
|
|
22
22
|
export const ImageAspectRatio = Media.AspectRatio;
|
|
23
|
-
|
|
23
|
+
const ImageRequestSchema = Schema.Struct({
|
|
24
24
|
model: ImageModelSchema,
|
|
25
25
|
prompt: Schema.String,
|
|
26
|
-
/** Edit sources or style/subject references, in order. */
|
|
27
26
|
images: Schema.optional(Schema.Array(Media.AssetSchema)),
|
|
28
27
|
n: Schema.optional(Schema.Int),
|
|
29
28
|
aspect: Schema.optional(ImageAspectRatio),
|
|
30
29
|
resolution: Schema.optional(Schema.String),
|
|
31
30
|
providerOptions: Schema.optional(ProviderOptions),
|
|
32
|
-
|
|
33
|
-
}) {
|
|
34
|
-
}
|
|
31
|
+
});
|
|
35
32
|
// ---------------------------------------------------------------------------
|
|
36
33
|
// Response and events
|
|
37
34
|
// ---------------------------------------------------------------------------
|
|
@@ -40,9 +37,6 @@ export class ImageResponse extends Schema.Class("Image.Response")({
|
|
|
40
37
|
usage: Schema.optional(MediaUsage),
|
|
41
38
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
42
39
|
}) {
|
|
43
|
-
get image() {
|
|
44
|
-
return this.images[0];
|
|
45
|
-
}
|
|
46
40
|
}
|
|
47
41
|
/** The `index`-th lower-fidelity preview of an image still generating; the `image` event supersedes it. */
|
|
48
42
|
export const ImagePartialEvent = Schema.Struct({
|
|
@@ -87,15 +81,20 @@ const collectResponse = (events) => {
|
|
|
87
81
|
providerMetadata: finish.providerMetadata,
|
|
88
82
|
}));
|
|
89
83
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
const
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// Request-shaped call API
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
/** Normalize image request input into a plain `ImageRequest`. */
|
|
88
|
+
export const request = (input) => ({
|
|
89
|
+
...input,
|
|
90
|
+
images: input.images?.map((image) => Media.make(image)),
|
|
91
|
+
});
|
|
92
|
+
const validate = Schema.decodeUnknownSync(ImageRequestSchema);
|
|
93
|
+
const requestEffect = (input) => tryRequest(() => {
|
|
94
|
+
const normalized = request(input);
|
|
95
|
+
validate(normalized);
|
|
96
|
+
return normalized;
|
|
97
|
+
});
|
|
99
98
|
export function generate(input, options) {
|
|
100
99
|
return requestEffect(input).pipe(Effect.flatMap((request) => ImageClient.generate(request, options)));
|
|
101
100
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { Effect, Layer, Schema } from "effect";
|
|
2
2
|
import { AIClient } from "./ai-client.js";
|
|
3
3
|
import { type DecisionModel, type DecisionQuestions, type DecisionRequestInput } from "./decision.js";
|
|
4
|
+
import { type EmbeddingModel, type EmbeddingRequestInput } from "./embedding.js";
|
|
4
5
|
import type { AwaitOptions, Event, Snapshot } from "./generation.js";
|
|
5
6
|
import { type ImageModel, type ImageRequest, type ImageRequestInput } from "./image.js";
|
|
6
7
|
import { LLM } from "./llm.js";
|
|
7
8
|
import { Media } from "./media.js";
|
|
8
9
|
import { type CheckpointRequest, type CompactionRequest, type EndpointCompactOptions, type StreamOptions, type TriggerCompactOptions } from "./route/client.js";
|
|
9
10
|
import { RequestExecutor } from "./route/executor.js";
|
|
10
|
-
import { LanguageModel, type CompactionCheckpointResponse, type CompactionResponse, type
|
|
11
|
-
import type {
|
|
11
|
+
import { LanguageModel, type CompactionCheckpointResponse, type CompactionResponse, type LLMEvent, type LLMResponse } from "./schema/index.js";
|
|
12
|
+
import type { LoopObjectEvent, ObjectEvent, ObjectResponse, OutputSchema, OutputType, LLMLoopInput, LLMRequestInput } from "./llm.js";
|
|
12
13
|
import { type SpeechModel, type SpeechRequest, type SpeechRequestInput } from "./speech.js";
|
|
13
14
|
import { type TranscriptionModel, type TranscriptionRequest, type TranscriptionRequestInput } from "./transcription.js";
|
|
14
|
-
import type { NoExecute, ToolExecuteContext, ToolOptions, ToolSchema } from "./tool.js";
|
|
15
|
+
import type { NoExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolOptions, ToolSchema } from "./tool.js";
|
|
15
16
|
import { type VideoModel, type VideoRequest, type VideoRequestInput } from "./video.js";
|
|
16
17
|
/**
|
|
17
18
|
* Promise-first entrypoint for scripts and non-Effect callers. One `ManagedRuntime` hosts the LLM, image, video, speech,
|
|
18
|
-
* transcription and
|
|
19
|
-
* `AIError` unchanged. `file` and `write` load `node:fs/promises` on first use, so importing this module does not.
|
|
19
|
+
* transcription, decision and embedding clients over a request executor; every method runs the corresponding Effect API
|
|
20
|
+
* and rethrows `AIError` unchanged. `file` and `write` load `node:fs/promises` on first use, so importing this module does not.
|
|
20
21
|
*/
|
|
21
|
-
export interface Options
|
|
22
|
+
export interface Options {
|
|
22
23
|
/** Executor layer; defaults to `RequestExecutor.fetchLayer`. Inject a recorder or `RequestExecutor.middleware(fn)` here. */
|
|
23
24
|
readonly layer?: Layer.Layer<RequestExecutor.Service>;
|
|
24
|
-
/** Replaces default clients, for example with `TestImage.testLayer()`; its other services are available to `run`. */
|
|
25
|
-
readonly clients?: Layer.Layer<R>;
|
|
26
25
|
}
|
|
27
26
|
export interface RunOptions {
|
|
28
27
|
readonly signal?: AbortSignal;
|
|
@@ -45,8 +44,8 @@ export type GenerationHandle<Response> = Snapshot & {
|
|
|
45
44
|
readonly refresh: (options?: RunOptions) => Promise<GenerationHandle<Response>>;
|
|
46
45
|
readonly cancel: (options?: RunOptions) => Promise<void>;
|
|
47
46
|
};
|
|
48
|
-
export declare const make:
|
|
49
|
-
run: <A, E>(effect: Effect.Effect<A, E, Services
|
|
47
|
+
export declare const make: (options?: Options) => {
|
|
48
|
+
run: <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) => Promise<A>;
|
|
50
49
|
/** Decoded asset bytes, downloading `url` sources through the executor. */
|
|
51
50
|
bytes: (asset: Media.Asset, options?: RunOptions) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
52
51
|
base64: (asset: Media.Asset, options?: RunOptions) => Promise<string>;
|
|
@@ -57,451 +56,26 @@ export declare const make: <R = never>(options?: Options<R>) => {
|
|
|
57
56
|
/** Write an asset's bytes like `Media.write`, downloading `url` sources through the executor. */
|
|
58
57
|
write: (asset: Media.Asset, path: string, options?: RunOptions) => Promise<void>;
|
|
59
58
|
request: typeof LLM.request;
|
|
60
|
-
generate:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
readonly [x: string]: unknown;
|
|
73
|
-
};
|
|
74
|
-
} | undefined;
|
|
75
|
-
} | {
|
|
76
|
-
readonly type: "text-delta";
|
|
77
|
-
readonly id: string;
|
|
78
|
-
readonly text: string;
|
|
79
|
-
readonly providerMetadata?: {
|
|
80
|
-
readonly [x: string]: {
|
|
81
|
-
readonly [x: string]: unknown;
|
|
82
|
-
};
|
|
83
|
-
} | undefined;
|
|
84
|
-
} | {
|
|
85
|
-
readonly type: "text-end";
|
|
86
|
-
readonly id: string;
|
|
87
|
-
readonly text?: string | undefined;
|
|
88
|
-
readonly providerMetadata?: {
|
|
89
|
-
readonly [x: string]: {
|
|
90
|
-
readonly [x: string]: unknown;
|
|
91
|
-
};
|
|
92
|
-
} | undefined;
|
|
93
|
-
} | {
|
|
94
|
-
readonly type: "reasoning-start";
|
|
95
|
-
readonly id: string;
|
|
96
|
-
readonly providerMetadata?: {
|
|
97
|
-
readonly [x: string]: {
|
|
98
|
-
readonly [x: string]: unknown;
|
|
99
|
-
};
|
|
100
|
-
} | undefined;
|
|
101
|
-
} | {
|
|
102
|
-
readonly type: "reasoning-delta";
|
|
103
|
-
readonly id: string;
|
|
104
|
-
readonly text: string;
|
|
105
|
-
readonly providerMetadata?: {
|
|
106
|
-
readonly [x: string]: {
|
|
107
|
-
readonly [x: string]: unknown;
|
|
108
|
-
};
|
|
109
|
-
} | undefined;
|
|
110
|
-
} | {
|
|
111
|
-
readonly type: "reasoning-end";
|
|
112
|
-
readonly id: string;
|
|
113
|
-
readonly text?: string | undefined;
|
|
114
|
-
readonly providerMetadata?: {
|
|
115
|
-
readonly [x: string]: {
|
|
116
|
-
readonly [x: string]: unknown;
|
|
117
|
-
};
|
|
118
|
-
} | undefined;
|
|
119
|
-
} | {
|
|
120
|
-
readonly type: "tool-input-start";
|
|
121
|
-
readonly id: string;
|
|
122
|
-
readonly name: string;
|
|
123
|
-
readonly namespace?: string | undefined;
|
|
124
|
-
readonly providerExecuted?: boolean | undefined;
|
|
125
|
-
readonly providerMetadata?: {
|
|
126
|
-
readonly [x: string]: {
|
|
127
|
-
readonly [x: string]: unknown;
|
|
128
|
-
};
|
|
129
|
-
} | undefined;
|
|
130
|
-
} | {
|
|
131
|
-
readonly type: "tool-input-delta";
|
|
132
|
-
readonly id: string;
|
|
133
|
-
readonly name: string;
|
|
134
|
-
readonly namespace?: string | undefined;
|
|
135
|
-
readonly text: string;
|
|
136
|
-
readonly input?: unknown;
|
|
137
|
-
} | {
|
|
138
|
-
readonly type: "tool-input-end";
|
|
139
|
-
readonly id: string;
|
|
140
|
-
readonly name: string;
|
|
141
|
-
readonly namespace?: string | undefined;
|
|
142
|
-
readonly providerMetadata?: {
|
|
143
|
-
readonly [x: string]: {
|
|
144
|
-
readonly [x: string]: unknown;
|
|
145
|
-
};
|
|
146
|
-
} | undefined;
|
|
147
|
-
} | {
|
|
148
|
-
readonly type: "tool-input-error";
|
|
149
|
-
readonly id: string;
|
|
150
|
-
readonly name: string;
|
|
151
|
-
readonly namespace?: string | undefined;
|
|
152
|
-
readonly raw: string;
|
|
153
|
-
} | {
|
|
154
|
-
readonly type: "tool-call";
|
|
155
|
-
readonly id: string;
|
|
156
|
-
readonly name: string;
|
|
157
|
-
readonly namespace?: string | undefined;
|
|
158
|
-
readonly input: unknown;
|
|
159
|
-
readonly providerExecuted?: boolean | undefined;
|
|
160
|
-
readonly providerMetadata?: {
|
|
161
|
-
readonly [x: string]: {
|
|
162
|
-
readonly [x: string]: unknown;
|
|
163
|
-
};
|
|
164
|
-
} | undefined;
|
|
165
|
-
} | {
|
|
166
|
-
readonly type: "tool-result";
|
|
167
|
-
readonly id: string;
|
|
168
|
-
readonly name: string;
|
|
169
|
-
readonly namespace?: string | undefined;
|
|
170
|
-
readonly result: {
|
|
171
|
-
readonly type: "json";
|
|
172
|
-
readonly value: unknown;
|
|
173
|
-
} | {
|
|
174
|
-
readonly type: "text";
|
|
175
|
-
readonly value: unknown;
|
|
176
|
-
} | {
|
|
177
|
-
readonly type: "error";
|
|
178
|
-
readonly value: unknown;
|
|
179
|
-
} | {
|
|
180
|
-
readonly type: "content";
|
|
181
|
-
readonly value: readonly ({
|
|
182
|
-
readonly type: "text";
|
|
183
|
-
readonly text: string;
|
|
184
|
-
} | {
|
|
185
|
-
readonly type: "file";
|
|
186
|
-
readonly uri: string;
|
|
187
|
-
readonly mime: string;
|
|
188
|
-
readonly name?: string | undefined;
|
|
189
|
-
})[];
|
|
190
|
-
};
|
|
191
|
-
readonly output?: {
|
|
192
|
-
readonly structured: unknown;
|
|
193
|
-
readonly content: readonly ({
|
|
194
|
-
readonly type: "text";
|
|
195
|
-
readonly text: string;
|
|
196
|
-
} | {
|
|
197
|
-
readonly type: "file";
|
|
198
|
-
readonly uri: string;
|
|
199
|
-
readonly mime: string;
|
|
200
|
-
readonly name?: string | undefined;
|
|
201
|
-
})[];
|
|
202
|
-
} | undefined;
|
|
203
|
-
readonly providerExecuted?: boolean | undefined;
|
|
204
|
-
readonly providerMetadata?: {
|
|
205
|
-
readonly [x: string]: {
|
|
206
|
-
readonly [x: string]: unknown;
|
|
207
|
-
};
|
|
208
|
-
} | undefined;
|
|
209
|
-
} | {
|
|
210
|
-
readonly type: "tool-error";
|
|
211
|
-
readonly id: string;
|
|
212
|
-
readonly name: string;
|
|
213
|
-
readonly namespace?: string | undefined;
|
|
214
|
-
readonly message: string;
|
|
215
|
-
readonly error?: unknown;
|
|
216
|
-
readonly providerMetadata?: {
|
|
217
|
-
readonly [x: string]: {
|
|
218
|
-
readonly [x: string]: unknown;
|
|
219
|
-
};
|
|
220
|
-
} | undefined;
|
|
221
|
-
} | {
|
|
222
|
-
readonly type: "step-finish";
|
|
223
|
-
readonly index: number;
|
|
224
|
-
readonly reason: {
|
|
225
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
226
|
-
readonly raw?: string | undefined;
|
|
227
|
-
readonly category?: string | undefined;
|
|
228
|
-
readonly explanation?: string | undefined;
|
|
229
|
-
};
|
|
230
|
-
readonly usage?: import("./index.js").Usage | undefined;
|
|
231
|
-
readonly providerMetadata?: {
|
|
232
|
-
readonly [x: string]: {
|
|
233
|
-
readonly [x: string]: unknown;
|
|
234
|
-
};
|
|
235
|
-
} | undefined;
|
|
236
|
-
} | {
|
|
237
|
-
readonly type: "finish";
|
|
238
|
-
readonly reason: {
|
|
239
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
240
|
-
readonly raw?: string | undefined;
|
|
241
|
-
readonly category?: string | undefined;
|
|
242
|
-
readonly explanation?: string | undefined;
|
|
243
|
-
};
|
|
244
|
-
readonly usage?: import("./index.js").Usage | undefined;
|
|
245
|
-
readonly providerMetadata?: {
|
|
246
|
-
readonly [x: string]: {
|
|
247
|
-
readonly [x: string]: unknown;
|
|
248
|
-
};
|
|
249
|
-
} | undefined;
|
|
250
|
-
} | {
|
|
251
|
-
readonly type: "media";
|
|
252
|
-
readonly media: Media.Asset;
|
|
253
|
-
readonly providerMetadata?: {
|
|
254
|
-
readonly [x: string]: {
|
|
255
|
-
readonly [x: string]: unknown;
|
|
256
|
-
};
|
|
257
|
-
} | undefined;
|
|
258
|
-
} | {
|
|
259
|
-
readonly type: "provider-error";
|
|
260
|
-
readonly message: string;
|
|
261
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
262
|
-
readonly providerMetadata?: {
|
|
263
|
-
readonly [x: string]: {
|
|
264
|
-
readonly [x: string]: unknown;
|
|
265
|
-
};
|
|
266
|
-
} | undefined;
|
|
267
|
-
} | ({
|
|
268
|
-
readonly type: "compaction";
|
|
269
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
270
|
-
readonly id?: string | undefined;
|
|
271
|
-
readonly encrypted?: string | undefined;
|
|
272
|
-
readonly text?: string | null | undefined;
|
|
273
|
-
} & ({
|
|
274
|
-
readonly encrypted: string;
|
|
275
|
-
readonly text?: never;
|
|
276
|
-
} | {
|
|
277
|
-
readonly text: string | null;
|
|
278
|
-
readonly encrypted?: never;
|
|
279
|
-
}))>;
|
|
59
|
+
generate: {
|
|
60
|
+
<const Model extends LanguageModel, S extends OutputSchema>(input: LLMRequestInput<Model> & {
|
|
61
|
+
readonly schema: S;
|
|
62
|
+
}, options?: StreamOptions & RunOptions): Promise<ObjectResponse<OutputType<S>>>;
|
|
63
|
+
<const Model extends LanguageModel>(input: LLMRequestInput<Model>, options?: StreamOptions & RunOptions): Promise<LLMResponse>;
|
|
64
|
+
};
|
|
65
|
+
stream: {
|
|
66
|
+
<const Model extends LanguageModel, S extends OutputSchema>(input: LLMRequestInput<Model> & {
|
|
67
|
+
readonly schema: S;
|
|
68
|
+
}, options?: StreamOptions & RunOptions): AsyncIterable<ObjectEvent<OutputType<S>>>;
|
|
69
|
+
<const Model extends LanguageModel>(input: LLMRequestInput<Model>, options?: StreamOptions & RunOptions): AsyncIterable<LLMEvent>;
|
|
70
|
+
};
|
|
280
71
|
/** Stream model calls, running their tool calls, until the model stops calling tools or `until` is true. */
|
|
281
|
-
loop:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
readonly data: unknown;
|
|
287
|
-
} | {
|
|
288
|
-
readonly type: "text-start";
|
|
289
|
-
readonly id: string;
|
|
290
|
-
readonly providerMetadata?: {
|
|
291
|
-
readonly [x: string]: {
|
|
292
|
-
readonly [x: string]: unknown;
|
|
293
|
-
};
|
|
294
|
-
} | undefined;
|
|
295
|
-
} | {
|
|
296
|
-
readonly type: "text-delta";
|
|
297
|
-
readonly id: string;
|
|
298
|
-
readonly text: string;
|
|
299
|
-
readonly providerMetadata?: {
|
|
300
|
-
readonly [x: string]: {
|
|
301
|
-
readonly [x: string]: unknown;
|
|
302
|
-
};
|
|
303
|
-
} | undefined;
|
|
304
|
-
} | {
|
|
305
|
-
readonly type: "text-end";
|
|
306
|
-
readonly id: string;
|
|
307
|
-
readonly text?: string | undefined;
|
|
308
|
-
readonly providerMetadata?: {
|
|
309
|
-
readonly [x: string]: {
|
|
310
|
-
readonly [x: string]: unknown;
|
|
311
|
-
};
|
|
312
|
-
} | undefined;
|
|
313
|
-
} | {
|
|
314
|
-
readonly type: "reasoning-start";
|
|
315
|
-
readonly id: string;
|
|
316
|
-
readonly providerMetadata?: {
|
|
317
|
-
readonly [x: string]: {
|
|
318
|
-
readonly [x: string]: unknown;
|
|
319
|
-
};
|
|
320
|
-
} | undefined;
|
|
321
|
-
} | {
|
|
322
|
-
readonly type: "reasoning-delta";
|
|
323
|
-
readonly id: string;
|
|
324
|
-
readonly text: string;
|
|
325
|
-
readonly providerMetadata?: {
|
|
326
|
-
readonly [x: string]: {
|
|
327
|
-
readonly [x: string]: unknown;
|
|
328
|
-
};
|
|
329
|
-
} | undefined;
|
|
330
|
-
} | {
|
|
331
|
-
readonly type: "reasoning-end";
|
|
332
|
-
readonly id: string;
|
|
333
|
-
readonly text?: string | undefined;
|
|
334
|
-
readonly providerMetadata?: {
|
|
335
|
-
readonly [x: string]: {
|
|
336
|
-
readonly [x: string]: unknown;
|
|
337
|
-
};
|
|
338
|
-
} | undefined;
|
|
339
|
-
} | {
|
|
340
|
-
readonly type: "tool-input-start";
|
|
341
|
-
readonly id: string;
|
|
342
|
-
readonly name: string;
|
|
343
|
-
readonly namespace?: string | undefined;
|
|
344
|
-
readonly providerExecuted?: boolean | undefined;
|
|
345
|
-
readonly providerMetadata?: {
|
|
346
|
-
readonly [x: string]: {
|
|
347
|
-
readonly [x: string]: unknown;
|
|
348
|
-
};
|
|
349
|
-
} | undefined;
|
|
350
|
-
} | {
|
|
351
|
-
readonly type: "tool-input-delta";
|
|
352
|
-
readonly id: string;
|
|
353
|
-
readonly name: string;
|
|
354
|
-
readonly namespace?: string | undefined;
|
|
355
|
-
readonly text: string;
|
|
356
|
-
readonly input?: unknown;
|
|
357
|
-
} | {
|
|
358
|
-
readonly type: "tool-input-end";
|
|
359
|
-
readonly id: string;
|
|
360
|
-
readonly name: string;
|
|
361
|
-
readonly namespace?: string | undefined;
|
|
362
|
-
readonly providerMetadata?: {
|
|
363
|
-
readonly [x: string]: {
|
|
364
|
-
readonly [x: string]: unknown;
|
|
365
|
-
};
|
|
366
|
-
} | undefined;
|
|
367
|
-
} | {
|
|
368
|
-
readonly type: "tool-input-error";
|
|
369
|
-
readonly id: string;
|
|
370
|
-
readonly name: string;
|
|
371
|
-
readonly namespace?: string | undefined;
|
|
372
|
-
readonly raw: string;
|
|
373
|
-
} | {
|
|
374
|
-
readonly type: "tool-call";
|
|
375
|
-
readonly id: string;
|
|
376
|
-
readonly name: string;
|
|
377
|
-
readonly namespace?: string | undefined;
|
|
378
|
-
readonly input: unknown;
|
|
379
|
-
readonly providerExecuted?: boolean | undefined;
|
|
380
|
-
readonly providerMetadata?: {
|
|
381
|
-
readonly [x: string]: {
|
|
382
|
-
readonly [x: string]: unknown;
|
|
383
|
-
};
|
|
384
|
-
} | undefined;
|
|
385
|
-
} | {
|
|
386
|
-
readonly type: "tool-result";
|
|
387
|
-
readonly id: string;
|
|
388
|
-
readonly name: string;
|
|
389
|
-
readonly namespace?: string | undefined;
|
|
390
|
-
readonly result: {
|
|
391
|
-
readonly type: "json";
|
|
392
|
-
readonly value: unknown;
|
|
393
|
-
} | {
|
|
394
|
-
readonly type: "text";
|
|
395
|
-
readonly value: unknown;
|
|
396
|
-
} | {
|
|
397
|
-
readonly type: "error";
|
|
398
|
-
readonly value: unknown;
|
|
399
|
-
} | {
|
|
400
|
-
readonly type: "content";
|
|
401
|
-
readonly value: readonly ({
|
|
402
|
-
readonly type: "text";
|
|
403
|
-
readonly text: string;
|
|
404
|
-
} | {
|
|
405
|
-
readonly type: "file";
|
|
406
|
-
readonly uri: string;
|
|
407
|
-
readonly mime: string;
|
|
408
|
-
readonly name?: string | undefined;
|
|
409
|
-
})[];
|
|
410
|
-
};
|
|
411
|
-
readonly output?: {
|
|
412
|
-
readonly structured: unknown;
|
|
413
|
-
readonly content: readonly ({
|
|
414
|
-
readonly type: "text";
|
|
415
|
-
readonly text: string;
|
|
416
|
-
} | {
|
|
417
|
-
readonly type: "file";
|
|
418
|
-
readonly uri: string;
|
|
419
|
-
readonly mime: string;
|
|
420
|
-
readonly name?: string | undefined;
|
|
421
|
-
})[];
|
|
422
|
-
} | undefined;
|
|
423
|
-
readonly providerExecuted?: boolean | undefined;
|
|
424
|
-
readonly providerMetadata?: {
|
|
425
|
-
readonly [x: string]: {
|
|
426
|
-
readonly [x: string]: unknown;
|
|
427
|
-
};
|
|
428
|
-
} | undefined;
|
|
429
|
-
} | {
|
|
430
|
-
readonly type: "tool-error";
|
|
431
|
-
readonly id: string;
|
|
432
|
-
readonly name: string;
|
|
433
|
-
readonly namespace?: string | undefined;
|
|
434
|
-
readonly message: string;
|
|
435
|
-
readonly error?: unknown;
|
|
436
|
-
readonly providerMetadata?: {
|
|
437
|
-
readonly [x: string]: {
|
|
438
|
-
readonly [x: string]: unknown;
|
|
439
|
-
};
|
|
440
|
-
} | undefined;
|
|
441
|
-
} | {
|
|
442
|
-
readonly type: "step-finish";
|
|
443
|
-
readonly index: number;
|
|
444
|
-
readonly reason: {
|
|
445
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
446
|
-
readonly raw?: string | undefined;
|
|
447
|
-
readonly category?: string | undefined;
|
|
448
|
-
readonly explanation?: string | undefined;
|
|
449
|
-
};
|
|
450
|
-
readonly usage?: import("./index.js").Usage | undefined;
|
|
451
|
-
readonly providerMetadata?: {
|
|
452
|
-
readonly [x: string]: {
|
|
453
|
-
readonly [x: string]: unknown;
|
|
454
|
-
};
|
|
455
|
-
} | undefined;
|
|
456
|
-
} | {
|
|
457
|
-
readonly type: "finish";
|
|
458
|
-
readonly reason: {
|
|
459
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
460
|
-
readonly raw?: string | undefined;
|
|
461
|
-
readonly category?: string | undefined;
|
|
462
|
-
readonly explanation?: string | undefined;
|
|
463
|
-
};
|
|
464
|
-
readonly usage?: import("./index.js").Usage | undefined;
|
|
465
|
-
readonly providerMetadata?: {
|
|
466
|
-
readonly [x: string]: {
|
|
467
|
-
readonly [x: string]: unknown;
|
|
468
|
-
};
|
|
469
|
-
} | undefined;
|
|
470
|
-
} | {
|
|
471
|
-
readonly type: "media";
|
|
472
|
-
readonly media: Media.Asset;
|
|
473
|
-
readonly providerMetadata?: {
|
|
474
|
-
readonly [x: string]: {
|
|
475
|
-
readonly [x: string]: unknown;
|
|
476
|
-
};
|
|
477
|
-
} | undefined;
|
|
478
|
-
} | {
|
|
479
|
-
readonly type: "provider-error";
|
|
480
|
-
readonly message: string;
|
|
481
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
482
|
-
readonly providerMetadata?: {
|
|
483
|
-
readonly [x: string]: {
|
|
484
|
-
readonly [x: string]: unknown;
|
|
485
|
-
};
|
|
486
|
-
} | undefined;
|
|
487
|
-
} | ({
|
|
488
|
-
readonly type: "compaction";
|
|
489
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
490
|
-
readonly id?: string | undefined;
|
|
491
|
-
readonly encrypted?: string | undefined;
|
|
492
|
-
readonly text?: string | null | undefined;
|
|
493
|
-
} & ({
|
|
494
|
-
readonly encrypted: string;
|
|
495
|
-
readonly text?: never;
|
|
496
|
-
} | {
|
|
497
|
-
readonly text: string | null;
|
|
498
|
-
readonly encrypted?: never;
|
|
499
|
-
}))>;
|
|
500
|
-
/** Decode the model's output against `schema` (or `jsonSchema`, unvalidated). */
|
|
501
|
-
generateObject: {
|
|
502
|
-
<const Model extends LanguageModel, S extends ToolSchema<any>>(input: GenerateObjectOptions<S, Model>, options?: RunOptions): Promise<GenerateObjectResponse<Schema.Schema.Type<S>>>;
|
|
503
|
-
<const Model extends LanguageModel>(input: GenerateObjectDynamicOptions<Model>, options?: RunOptions): Promise<GenerateObjectResponse<unknown>>;
|
|
72
|
+
loop: {
|
|
73
|
+
<const Model extends LanguageModel, S extends OutputSchema>(input: LLMLoopInput<Model> & {
|
|
74
|
+
readonly schema: S;
|
|
75
|
+
}, options?: StreamOptions & RunOptions): AsyncIterable<LoopObjectEvent<OutputType<S>>>;
|
|
76
|
+
<const Model extends LanguageModel>(input: LLMLoopInput<Model>, options?: StreamOptions & RunOptions): AsyncIterable<LLMEvent>;
|
|
504
77
|
};
|
|
78
|
+
collect: <Event extends LLMEvent>(events: AsyncIterable<Event>, options?: RunOptions) => Promise<LLM.CollectResult<Event>>;
|
|
505
79
|
/** Compact a Responses request: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
|
|
506
80
|
compact: {
|
|
507
81
|
(request: CheckpointRequest, options: TriggerCompactOptions & RunOptions): Promise<CompactionCheckpointResponse>;
|
|
@@ -563,6 +137,10 @@ export declare const make: <R = never>(options?: Options<R>) => {
|
|
|
563
137
|
request: typeof import("./decision.js").request;
|
|
564
138
|
generate: <const Model extends DecisionModel, const Questions extends DecisionQuestions>(input: DecisionRequestInput<Model, Questions>, options?: RunOptions) => Promise<import("./decision.js").DecisionResponseFor<Questions>>;
|
|
565
139
|
};
|
|
140
|
+
embedding: {
|
|
141
|
+
request: typeof import("./embedding.js").request;
|
|
142
|
+
generate: <const Model extends EmbeddingModel>(input: EmbeddingRequestInput<Model>, options?: RunOptions) => Promise<import("./embedding.js").EmbeddingResponse>;
|
|
143
|
+
};
|
|
566
144
|
/** Experimental: may change without compatibility guarantees. */
|
|
567
145
|
experimental: {
|
|
568
146
|
speech: {
|
|
@@ -737,22 +315,12 @@ export declare const make: <R = never>(options?: Options<R>) => {
|
|
|
737
315
|
};
|
|
738
316
|
dispose: () => Promise<void>;
|
|
739
317
|
};
|
|
740
|
-
export type Client
|
|
318
|
+
export type Client = ReturnType<typeof make>;
|
|
741
319
|
/** `tool` from `@opencode/ai/effect`, with an `execute` that returns a value or a Promise and throws to fail. */
|
|
742
|
-
export declare const tool: <
|
|
320
|
+
export declare const tool: <Input extends ToolInput = typeof Schema.Unknown, Success extends ToolSchema<any> = typeof Schema.Unknown, Result extends Schema.Schema.Type<Success> | PromiseLike<Schema.Schema.Type<Success>> | NoExecute = NoExecute>(config: ToolOptions<Input, Success, (input: ToolInputType<Input>, context: Partial<ToolExecuteContext> & {
|
|
743
321
|
signal: AbortSignal;
|
|
744
|
-
}) => Result>) => 0 extends 1 & Result ? import("./tool.js").ExecutableTool<
|
|
322
|
+
}) => Result>) => 0 extends 1 & Result ? import("./tool.js").ExecutableTool<Input, Success> : [Result, NoExecute] extends [NoExecute, Result] ? import("./tool.js").Tool<Input, Success> : import("./tool.js").ExecutableTool<Input, Success>;
|
|
745
323
|
/** Default client over `RequestExecutor.fetchLayer`; the runtime builds its layer on first use and holds nothing to dispose. */
|
|
746
324
|
export declare const ai: Omit<Client, "dispose">;
|
|
747
325
|
export * as AI from "./index.js";
|
|
748
|
-
export
|
|
749
|
-
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, HttpOptions, GenerationOptions, LanguageModelDefaults, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, Message, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, LLMRequest, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, ToolError, FinishReasonDetails, StepFinish, Finish, MediaEvent, ProviderErrorEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, NoRouteError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
750
|
-
export type { GenerationOptionsFields, GenerationOptionsInput, LanguageModelInput, LanguageModelProviderOptions, ToolDefinitionInput, ToolNamespaceInput, ToolNamespaceEntryInput, ToolEntryInput, UsageInput, } from "./schema/index.js";
|
|
751
|
-
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageRequest, ImageResponse } from "./image.js";
|
|
752
|
-
export type { ImageModelOptions, ImageOptions, ImageRequestFor, ImageRequestInput, ImageResolution, ImageRoute, } from "./image.js";
|
|
753
|
-
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionRequest, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
|
754
|
-
export type { AnswerFor, AnswersFor, DecisionInput, DecisionModelOptions, DecisionOptions, DecisionQuestions, DecisionRequestFor, DecisionRequestInput, DecisionResponseFor, DecisionModelRoute, } from "./decision.js";
|
|
755
|
-
export { Media } from "./media.js";
|
|
756
|
-
export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
|
|
757
|
-
export type { ExecutableTool, Tool, ToolExecute, ToolExecuteContext, ToolModelOutputInput, ToolOptions, Tools, ToolSchema, ToolToModelOutput, } from "./tool.js";
|
|
758
|
-
export type { LLM } from "./llm.js";
|
|
326
|
+
export * from "./public.js";
|