@opencode/ai 2.2.0 → 2.2.1
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 +66 -62
- package/dist/effect.d.ts +1 -1
- package/dist/effect.js +1 -1
- package/dist/image-client.d.ts +45 -0
- package/dist/index.d.ts +38 -20
- package/dist/index.js +14 -2
- package/dist/media-client.d.ts +1 -0
- package/dist/media-client.js +1 -0
- package/dist/protocols/alibaba-chat.d.ts +39 -4
- package/dist/protocols/alibaba-responses.d.ts +20 -3
- package/dist/protocols/google-images.js +3 -1
- package/dist/protocols/meta-responses.d.ts +40 -6
- package/dist/protocols/meta-responses.js +1 -1
- package/dist/protocols/minimax-images.d.ts +25 -0
- package/dist/protocols/minimax-images.js +150 -0
- package/dist/protocols/open-responses.d.ts +182 -27
- package/dist/protocols/open-responses.js +108 -36
- package/dist/protocols/openai-chat.d.ts +438 -46
- package/dist/protocols/openai-chat.js +121 -39
- package/dist/protocols/openai-compatible-chat.d.ts +35 -4
- package/dist/protocols/openai-compatible-responses.d.ts +20 -3
- package/dist/protocols/openai-freeform.d.ts +47 -0
- package/dist/protocols/openai-freeform.js +54 -0
- package/dist/protocols/openai-images.d.ts +16 -1
- package/dist/protocols/openai-images.js +49 -17
- package/dist/protocols/openai-responses.d.ts +120 -18
- package/dist/protocols/openai-responses.js +17 -8
- package/dist/protocols/venice-chat.d.ts +39 -4
- package/dist/protocols/venice-chat.js +1 -1
- package/dist/protocols/xai-images.d.ts +6 -0
- package/dist/protocols/xai-images.js +4 -5
- package/dist/protocols/xai-responses.d.ts +20 -3
- package/dist/protocols/xai-responses.js +2 -1
- package/dist/protocols/zai-chat.d.ts +39 -4
- package/dist/provider-error.js +5 -4
- package/dist/provider-package.d.ts +2 -0
- package/dist/providers/alibaba.d.ts +58 -10
- package/dist/providers/amazon-bedrock-mantle.d.ts +66 -11
- package/dist/providers/amazon-bedrock-mantle.js +1 -1
- package/dist/providers/amazon-bedrock.d.ts +1 -1
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/azure.d.ts +79 -15
- package/dist/providers/baseten.d.ts +74 -12
- package/dist/providers/baseten.js +1 -1
- package/dist/providers/cerebras.d.ts +73 -11
- package/dist/providers/cerebras.js +1 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +113 -17
- package/dist/providers/cloudflare-workers-ai.d.ts +73 -11
- package/dist/providers/cohere/chat.d.ts +1 -1
- package/dist/providers/cohere/chat.js +1 -1
- package/dist/providers/cohere.d.ts +73 -11
- package/dist/providers/cohere.js +1 -1
- package/dist/providers/deepinfra.d.ts +73 -11
- package/dist/providers/deepinfra.js +1 -1
- package/dist/providers/deepseek.d.ts +73 -11
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/digitalocean/responses.d.ts +4 -0
- package/dist/providers/digitalocean/responses.js +1 -0
- package/dist/providers/digitalocean.d.ts +320 -21
- package/dist/providers/digitalocean.js +18 -7
- package/dist/providers/fireworks.d.ts +73 -11
- package/dist/providers/fireworks.js +1 -1
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +1 -1
- package/dist/providers/google-vertex-chat.d.ts +36 -5
- package/dist/providers/google-vertex-chat.js +1 -1
- package/dist/providers/google-vertex-interactions.d.ts +1 -1
- package/dist/providers/google-vertex-interactions.js +1 -1
- package/dist/providers/google-vertex-messages.d.ts +1 -1
- package/dist/providers/google-vertex-messages.js +1 -1
- package/dist/providers/google-vertex-mistral.d.ts +1 -1
- package/dist/providers/google-vertex-mistral.js +1 -1
- package/dist/providers/google-vertex-responses.d.ts +21 -4
- package/dist/providers/google-vertex-responses.js +1 -1
- package/dist/providers/google-vertex.d.ts +2 -2
- package/dist/providers/google-vertex.js +1 -1
- package/dist/providers/google.d.ts +2 -2
- package/dist/providers/google.js +1 -1
- package/dist/providers/groq.d.ts +77 -11
- package/dist/providers/groq.js +1 -1
- package/dist/providers/index.d.ts +0 -4
- package/dist/providers/index.js +0 -4
- package/dist/providers/meta/images.d.ts +2 -0
- package/dist/providers/meta/images.js +1 -0
- package/dist/providers/meta.d.ts +61 -12
- package/dist/providers/meta.js +2 -1
- package/dist/providers/minimax/chat.d.ts +1 -1
- package/dist/providers/minimax/chat.js +1 -1
- package/dist/providers/minimax/images.d.ts +3 -0
- package/dist/providers/minimax/images.js +1 -0
- package/dist/providers/minimax/responses.d.ts +1 -1
- package/dist/providers/minimax/responses.js +1 -1
- package/dist/providers/minimax.d.ts +63 -9
- package/dist/providers/minimax.js +22 -9
- package/dist/providers/mistral.d.ts +3 -3
- package/dist/providers/mistral.js +1 -1
- package/dist/providers/moonshot/messages.d.ts +1 -1
- package/dist/providers/moonshot/messages.js +1 -1
- package/dist/providers/moonshot/responses.d.ts +1 -1
- package/dist/providers/moonshot/responses.js +1 -1
- package/dist/providers/moonshot.d.ts +56 -8
- package/dist/providers/moonshot.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +21 -4
- package/dist/providers/openai-compatible.d.ts +38 -7
- package/dist/providers/openai-compatible.js +9 -2
- package/dist/providers/openai.d.ts +59 -11
- package/dist/providers/openai.js +4 -2
- package/dist/providers/opencode.d.ts +3 -3
- package/dist/providers/opencode.js +1 -1
- package/dist/providers/openrouter/responses.d.ts +4 -0
- package/dist/providers/openrouter/responses.js +1 -0
- package/dist/providers/openrouter.d.ts +356 -26
- package/dist/providers/openrouter.js +42 -13
- package/dist/providers/togetherai.d.ts +73 -11
- package/dist/providers/togetherai.js +1 -1
- package/dist/providers/typesafe-ai.d.ts +3 -3
- package/dist/providers/typesafe-ai.js +1 -1
- package/dist/providers/venice/responses.d.ts +4 -0
- package/dist/providers/venice/responses.js +1 -0
- package/dist/providers/venice.d.ts +242 -9
- package/dist/providers/venice.js +33 -17
- package/dist/providers/vercel-ai-gateway.d.ts +8 -8
- package/dist/providers/vercel-ai-gateway.js +12 -2
- package/dist/providers/xai.d.ts +39 -8
- package/dist/providers/xai.js +1 -1
- package/dist/providers/zai-coding-plan/messages.d.ts +1 -1
- package/dist/providers/zai-coding-plan/messages.js +1 -1
- package/dist/providers/zai-coding-plan/responses.d.ts +1 -1
- package/dist/providers/zai-coding-plan/responses.js +1 -1
- package/dist/providers/zai-coding-plan.d.ts +56 -8
- package/dist/providers/zai-coding-plan.js +1 -1
- package/dist/providers/zai.d.ts +37 -6
- package/dist/providers/zai.js +1 -1
- package/dist/route/auth.d.ts +1 -1
- package/dist/route/media-protocol.d.ts +2 -4
- package/dist/route/media.d.ts +1 -1
- package/dist/route/media.js +2 -4
- package/dist/schema/messages.d.ts +35 -1
- package/dist/schema/messages.js +20 -0
- package/dist/speech-client.d.ts +48 -0
- package/dist/testing/decision.d.ts +16 -0
- package/dist/testing/decision.js +20 -0
- package/dist/testing/image.d.ts +14 -0
- package/dist/testing/image.js +12 -0
- package/dist/testing/media.d.ts +18 -0
- package/dist/testing/media.js +36 -0
- package/dist/testing/script.d.ts +28 -0
- package/dist/testing/script.js +60 -0
- package/dist/testing/speech.d.ts +14 -0
- package/dist/testing/speech.js +12 -0
- package/dist/testing/transcription.d.ts +14 -0
- package/dist/testing/transcription.js +12 -0
- package/dist/testing/video.d.ts +14 -0
- package/dist/testing/video.js +12 -0
- package/dist/testing.d.ts +10 -21
- package/dist/testing.js +11 -54
- package/dist/tool.d.ts +12 -1
- package/dist/tool.js +10 -2
- package/dist/transcription-client.d.ts +64 -0
- package/dist/video-client.d.ts +41 -0
- package/package.json +22 -38
- package/dist/protocols/bfl-images.d.ts +0 -47
- package/dist/protocols/bfl-images.js +0 -155
- package/dist/protocols/fal-images.d.ts +0 -34
- package/dist/protocols/fal-images.js +0 -95
- package/dist/protocols/fal-video.d.ts +0 -29
- package/dist/protocols/fal-video.js +0 -73
- package/dist/protocols/replicate-images.d.ts +0 -28
- package/dist/protocols/replicate-images.js +0 -127
- package/dist/protocols/stability-images.d.ts +0 -44
- package/dist/protocols/stability-images.js +0 -131
- package/dist/protocols/utils/fal-queue.d.ts +0 -26
- package/dist/protocols/utils/fal-queue.js +0 -67
- package/dist/providers/black-forest-labs.d.ts +0 -21
- package/dist/providers/black-forest-labs.js +0 -23
- package/dist/providers/fal.d.ts +0 -24
- package/dist/providers/fal.js +0 -26
- package/dist/providers/replicate.d.ts +0 -21
- package/dist/providers/replicate.js +0 -17
- package/dist/providers/stability.d.ts +0 -23
- package/dist/providers/stability.js +0 -18
|
@@ -4,6 +4,7 @@ import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
|
4
4
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
5
5
|
import { OpenAIDecisions } from "../protocols/openai-decisions.js";
|
|
6
6
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
7
|
+
import { XAIImages } from "../protocols/xai-images.js";
|
|
7
8
|
import { ProviderShared } from "../protocols/shared.js";
|
|
8
9
|
import { gatewayProtocol } from "../protocols/utils/gateway-protocol.js";
|
|
9
10
|
import { AuthOptions } from "../route/auth-options.js";
|
|
@@ -106,6 +107,15 @@ const chatRoute = route({
|
|
|
106
107
|
framing: OpenAIChat.framing,
|
|
107
108
|
});
|
|
108
109
|
export const routes = [messagesRoute, responsesRoute, chatRoute];
|
|
110
|
+
// The Gateway passes `size` through to most image models, but Grok ignores it and renders 1024x1024; it only reads
|
|
111
|
+
// sizing from `providerOptions.xai`.
|
|
112
|
+
const imageSizing = (request) => {
|
|
113
|
+
if (!/^(spacexai|xai)\//.test(request.model.id))
|
|
114
|
+
return OpenAIImages.pixelSize(request);
|
|
115
|
+
if (request.aspect === undefined && request.resolution === undefined)
|
|
116
|
+
return undefined;
|
|
117
|
+
return { providerOptions: { xai: { aspect_ratio: request.aspect, resolution: XAIImages.resolution(request) } } };
|
|
118
|
+
};
|
|
109
119
|
export const configure = (input = {}) => {
|
|
110
120
|
const { apiKey: _apiKey, auth: _auth, baseURL: endpoint, ...defaults } = input;
|
|
111
121
|
const configured = {
|
|
@@ -131,7 +141,7 @@ export const configure = (input = {}) => {
|
|
|
131
141
|
return messages(modelID);
|
|
132
142
|
};
|
|
133
143
|
const media = MediaRoute.deployment({ ...input, baseURL: configured.endpoint.baseURL }, configured.auth);
|
|
134
|
-
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions });
|
|
144
|
+
const image = (modelID, providerOptions) => OpenAIImages.model({ ...media, id: modelID, provider: id, providerOptions, sizing: imageSizing });
|
|
135
145
|
const decisionRoute = OpenAIDecisions.route.with({
|
|
136
146
|
provider: id,
|
|
137
147
|
endpoint: { baseURL: configured.endpoint.baseURL },
|
|
@@ -160,7 +170,7 @@ export const decisionModel = (modelID, settings) => {
|
|
|
160
170
|
const input = config(settings);
|
|
161
171
|
return configure(input).decision(modelID, input.providerOptions);
|
|
162
172
|
};
|
|
163
|
-
function config({ apiKey, baseURL, headers, body, ...providerOptions }) {
|
|
173
|
+
function config({ apiKey, baseURL, headers, body, ...providerOptions } = {}) {
|
|
164
174
|
return {
|
|
165
175
|
apiKey,
|
|
166
176
|
baseURL,
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
|
8
8
|
export type XAIProviderOptionsInput = OpenAIOptionsInput & XAIResponses.OptionsInput & {
|
|
9
9
|
readonly contextManagement?: never;
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
11
|
+
export type Config = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
12
12
|
readonly baseURL?: string;
|
|
13
13
|
readonly providerOptions?: XAIProviderOptionsInput;
|
|
14
14
|
};
|
|
@@ -99,7 +99,14 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
|
|
|
99
99
|
readonly ttl?: string | undefined;
|
|
100
100
|
} | undefined;
|
|
101
101
|
}[] | null;
|
|
102
|
-
readonly tool_calls?: readonly {
|
|
102
|
+
readonly tool_calls?: readonly ({
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly type: "custom";
|
|
105
|
+
readonly custom: {
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly input: string;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
103
110
|
readonly id: string;
|
|
104
111
|
readonly type: "function";
|
|
105
112
|
readonly function: {
|
|
@@ -111,13 +118,13 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
|
|
|
111
118
|
readonly thought_signature: string;
|
|
112
119
|
};
|
|
113
120
|
} | undefined;
|
|
114
|
-
}[] | undefined;
|
|
121
|
+
})[] | undefined;
|
|
115
122
|
readonly reasoning_content?: string | undefined;
|
|
116
123
|
readonly reasoning?: string | undefined;
|
|
117
124
|
readonly reasoning_text?: string | undefined;
|
|
118
125
|
readonly reasoning_details?: unknown;
|
|
119
126
|
})[];
|
|
120
|
-
readonly tools?: readonly {
|
|
127
|
+
readonly tools?: readonly ({
|
|
121
128
|
readonly type: "function";
|
|
122
129
|
readonly function: {
|
|
123
130
|
readonly name: string;
|
|
@@ -131,12 +138,36 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
|
|
|
131
138
|
readonly type: "ephemeral";
|
|
132
139
|
readonly ttl?: string | undefined;
|
|
133
140
|
} | undefined;
|
|
134
|
-
}
|
|
141
|
+
} | {
|
|
142
|
+
readonly type: "custom";
|
|
143
|
+
readonly custom: {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
readonly description: string;
|
|
146
|
+
readonly format: {
|
|
147
|
+
readonly type: "text";
|
|
148
|
+
} | {
|
|
149
|
+
readonly type: "grammar";
|
|
150
|
+
readonly grammar: {
|
|
151
|
+
readonly syntax: "lark" | "regex";
|
|
152
|
+
readonly definition: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly cache_control?: {
|
|
157
|
+
readonly type: "ephemeral";
|
|
158
|
+
readonly ttl?: string | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
})[] | undefined;
|
|
135
161
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
136
162
|
readonly type: "function";
|
|
137
163
|
readonly function: {
|
|
138
164
|
readonly name: string;
|
|
139
165
|
};
|
|
166
|
+
} | {
|
|
167
|
+
readonly type: "custom";
|
|
168
|
+
readonly custom: {
|
|
169
|
+
readonly name: string;
|
|
170
|
+
};
|
|
140
171
|
} | undefined;
|
|
141
172
|
readonly stream: true;
|
|
142
173
|
readonly stream_options?: {
|
|
@@ -166,7 +197,7 @@ export declare const routes: (Route<unknown, import("../protocols/open-responses
|
|
|
166
197
|
readonly seed?: number | undefined;
|
|
167
198
|
readonly stop?: readonly string[] | undefined;
|
|
168
199
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>)[];
|
|
169
|
-
export declare const configure: (input?:
|
|
200
|
+
export declare const configure: (input?: Config) => {
|
|
170
201
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
171
202
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, {
|
|
172
203
|
endpoint: import("../route/client.js").CompactOperation;
|
|
@@ -192,8 +223,8 @@ export declare const provider: {
|
|
|
192
223
|
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
193
224
|
configure: typeof configure;
|
|
194
225
|
};
|
|
195
|
-
export declare const model: ProviderPackage.
|
|
196
|
-
export declare const imageModel: (modelID: string, settings
|
|
226
|
+
export declare const model: ProviderPackage.Model<Settings, XAIProviderOptionsInput, typeof responsesRoute.compact>;
|
|
227
|
+
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
197
228
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, {
|
|
198
229
|
endpoint: import("../route/client.js").CompactOperation;
|
|
199
230
|
}>;
|
package/dist/providers/xai.js
CHANGED
|
@@ -78,7 +78,7 @@ export const imageModel = (modelID, settings) => {
|
|
|
78
78
|
const input = config(settings);
|
|
79
79
|
return configure(input).image(modelID, input.providerOptions);
|
|
80
80
|
};
|
|
81
|
-
function config({ apiKey, baseURL, body, headers, ...providerOptions }) {
|
|
81
|
+
function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
82
82
|
return {
|
|
83
83
|
apiKey,
|
|
84
84
|
baseURL,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
2
|
import { ZAICodingPlan } from "../zai-coding-plan.js";
|
|
3
3
|
export type Settings = ZAICodingPlan.Settings<ZAICodingPlan.MessagesOptionsInput>;
|
|
4
|
-
export declare const model: ProviderPackage.
|
|
4
|
+
export declare const model: ProviderPackage.Model<Settings, ZAICodingPlan.MessagesOptionsInput>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZAICodingPlan } from "../zai-coding-plan.js";
|
|
2
|
-
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => ZAICodingPlan.configure({
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => ZAICodingPlan.configure({
|
|
3
3
|
apiKey,
|
|
4
4
|
baseURL,
|
|
5
5
|
headers,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
2
|
import { ZAICodingPlan } from "../zai-coding-plan.js";
|
|
3
3
|
export type Settings = ZAICodingPlan.Settings<ZAICodingPlan.ResponsesOptionsInput>;
|
|
4
|
-
export declare const model: ProviderPackage.
|
|
4
|
+
export declare const model: ProviderPackage.Model<Settings, ZAICodingPlan.ResponsesOptionsInput>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZAICodingPlan } from "../zai-coding-plan.js";
|
|
2
|
-
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => ZAICodingPlan.configure({
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => ZAICodingPlan.configure({
|
|
3
3
|
apiKey,
|
|
4
4
|
baseURL,
|
|
5
5
|
headers,
|
|
@@ -35,7 +35,7 @@ export declare const routes: (Route<{
|
|
|
35
35
|
readonly role: "developer";
|
|
36
36
|
readonly content: string;
|
|
37
37
|
} | {
|
|
38
|
-
readonly type: "function_call_output";
|
|
38
|
+
readonly type: "custom_tool_call_output" | "function_call_output";
|
|
39
39
|
readonly call_id: string;
|
|
40
40
|
readonly output: string | readonly ({
|
|
41
41
|
readonly type: "input_text";
|
|
@@ -105,6 +105,12 @@ export declare const routes: (Route<{
|
|
|
105
105
|
readonly name: string;
|
|
106
106
|
readonly namespace?: string | undefined;
|
|
107
107
|
readonly arguments: string;
|
|
108
|
+
} | {
|
|
109
|
+
readonly type: "custom_tool_call";
|
|
110
|
+
readonly id?: string | undefined;
|
|
111
|
+
readonly call_id: string;
|
|
112
|
+
readonly name: string;
|
|
113
|
+
readonly input: string;
|
|
108
114
|
} | {
|
|
109
115
|
readonly [x: string]: unknown;
|
|
110
116
|
readonly type: "web_search_call";
|
|
@@ -149,6 +155,17 @@ export declare const routes: (Route<{
|
|
|
149
155
|
})[];
|
|
150
156
|
readonly instructions?: string | undefined;
|
|
151
157
|
readonly tools?: readonly ({
|
|
158
|
+
readonly type: "custom";
|
|
159
|
+
readonly name: string;
|
|
160
|
+
readonly description: string;
|
|
161
|
+
readonly format: {
|
|
162
|
+
readonly type: "text";
|
|
163
|
+
} | {
|
|
164
|
+
readonly type: "grammar";
|
|
165
|
+
readonly syntax: "lark" | "regex";
|
|
166
|
+
readonly definition: string;
|
|
167
|
+
};
|
|
168
|
+
} | {
|
|
152
169
|
readonly type: "function";
|
|
153
170
|
readonly name: string;
|
|
154
171
|
readonly description: string;
|
|
@@ -161,13 +178,13 @@ export declare const routes: (Route<{
|
|
|
161
178
|
readonly type: string;
|
|
162
179
|
})[] | undefined;
|
|
163
180
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
164
|
-
readonly type: "function";
|
|
181
|
+
readonly type: "custom" | "function";
|
|
165
182
|
readonly name: string;
|
|
166
183
|
} | {
|
|
167
184
|
readonly type: "allowed_tools";
|
|
168
185
|
readonly mode: "auto" | "none" | "required";
|
|
169
186
|
readonly tools: readonly {
|
|
170
|
-
readonly type: "function";
|
|
187
|
+
readonly type: "custom" | "function";
|
|
171
188
|
readonly name: string;
|
|
172
189
|
}[];
|
|
173
190
|
} | undefined;
|
|
@@ -275,7 +292,14 @@ export declare const routes: (Route<{
|
|
|
275
292
|
readonly ttl?: string | undefined;
|
|
276
293
|
} | undefined;
|
|
277
294
|
}[] | null;
|
|
278
|
-
readonly tool_calls?: readonly {
|
|
295
|
+
readonly tool_calls?: readonly ({
|
|
296
|
+
readonly id: string;
|
|
297
|
+
readonly type: "custom";
|
|
298
|
+
readonly custom: {
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly input: string;
|
|
301
|
+
};
|
|
302
|
+
} | {
|
|
279
303
|
readonly id: string;
|
|
280
304
|
readonly type: "function";
|
|
281
305
|
readonly function: {
|
|
@@ -287,13 +311,13 @@ export declare const routes: (Route<{
|
|
|
287
311
|
readonly thought_signature: string;
|
|
288
312
|
};
|
|
289
313
|
} | undefined;
|
|
290
|
-
}[] | undefined;
|
|
314
|
+
})[] | undefined;
|
|
291
315
|
readonly reasoning_content?: string | undefined;
|
|
292
316
|
readonly reasoning?: string | undefined;
|
|
293
317
|
readonly reasoning_text?: string | undefined;
|
|
294
318
|
readonly reasoning_details?: unknown;
|
|
295
319
|
})[];
|
|
296
|
-
readonly tools?: readonly {
|
|
320
|
+
readonly tools?: readonly ({
|
|
297
321
|
readonly type: "function";
|
|
298
322
|
readonly function: {
|
|
299
323
|
readonly name: string;
|
|
@@ -307,12 +331,36 @@ export declare const routes: (Route<{
|
|
|
307
331
|
readonly type: "ephemeral";
|
|
308
332
|
readonly ttl?: string | undefined;
|
|
309
333
|
} | undefined;
|
|
310
|
-
}
|
|
334
|
+
} | {
|
|
335
|
+
readonly type: "custom";
|
|
336
|
+
readonly custom: {
|
|
337
|
+
readonly name: string;
|
|
338
|
+
readonly description: string;
|
|
339
|
+
readonly format: {
|
|
340
|
+
readonly type: "text";
|
|
341
|
+
} | {
|
|
342
|
+
readonly type: "grammar";
|
|
343
|
+
readonly grammar: {
|
|
344
|
+
readonly syntax: "lark" | "regex";
|
|
345
|
+
readonly definition: string;
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
readonly cache_control?: {
|
|
350
|
+
readonly type: "ephemeral";
|
|
351
|
+
readonly ttl?: string | undefined;
|
|
352
|
+
} | undefined;
|
|
353
|
+
})[] | undefined;
|
|
311
354
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
312
355
|
readonly type: "function";
|
|
313
356
|
readonly function: {
|
|
314
357
|
readonly name: string;
|
|
315
358
|
};
|
|
359
|
+
} | {
|
|
360
|
+
readonly type: "custom";
|
|
361
|
+
readonly custom: {
|
|
362
|
+
readonly name: string;
|
|
363
|
+
};
|
|
316
364
|
} | undefined;
|
|
317
365
|
readonly stream: true;
|
|
318
366
|
readonly stream_options?: {
|
|
@@ -745,5 +793,5 @@ export declare const messages: (modelID: string | ModelID) => import("../schema/
|
|
|
745
793
|
} | undefined;
|
|
746
794
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
747
795
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
748
|
-
export declare const model: ProviderPackage.
|
|
796
|
+
export declare const model: ProviderPackage.Model<Settings, ChatOptionsInput>;
|
|
749
797
|
export * as ZAICodingPlan from "./zai-coding-plan.js";
|
|
@@ -53,7 +53,7 @@ export const provider = configure();
|
|
|
53
53
|
export const chat = provider.chat;
|
|
54
54
|
export const messages = provider.messages;
|
|
55
55
|
export const responses = provider.responses;
|
|
56
|
-
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
56
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions } = {}) => configure({
|
|
57
57
|
apiKey,
|
|
58
58
|
baseURL,
|
|
59
59
|
headers,
|
package/dist/providers/zai.d.ts
CHANGED
|
@@ -90,7 +90,14 @@ export declare const routes: Route<{
|
|
|
90
90
|
readonly ttl?: string | undefined;
|
|
91
91
|
} | undefined;
|
|
92
92
|
}[] | null;
|
|
93
|
-
readonly tool_calls?: readonly {
|
|
93
|
+
readonly tool_calls?: readonly ({
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly type: "custom";
|
|
96
|
+
readonly custom: {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly input: string;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
94
101
|
readonly id: string;
|
|
95
102
|
readonly type: "function";
|
|
96
103
|
readonly function: {
|
|
@@ -102,13 +109,13 @@ export declare const routes: Route<{
|
|
|
102
109
|
readonly thought_signature: string;
|
|
103
110
|
};
|
|
104
111
|
} | undefined;
|
|
105
|
-
}[] | undefined;
|
|
112
|
+
})[] | undefined;
|
|
106
113
|
readonly reasoning_content?: string | undefined;
|
|
107
114
|
readonly reasoning?: string | undefined;
|
|
108
115
|
readonly reasoning_text?: string | undefined;
|
|
109
116
|
readonly reasoning_details?: unknown;
|
|
110
117
|
})[];
|
|
111
|
-
readonly tools?: readonly {
|
|
118
|
+
readonly tools?: readonly ({
|
|
112
119
|
readonly type: "function";
|
|
113
120
|
readonly function: {
|
|
114
121
|
readonly name: string;
|
|
@@ -122,12 +129,36 @@ export declare const routes: Route<{
|
|
|
122
129
|
readonly type: "ephemeral";
|
|
123
130
|
readonly ttl?: string | undefined;
|
|
124
131
|
} | undefined;
|
|
125
|
-
}
|
|
132
|
+
} | {
|
|
133
|
+
readonly type: "custom";
|
|
134
|
+
readonly custom: {
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly description: string;
|
|
137
|
+
readonly format: {
|
|
138
|
+
readonly type: "text";
|
|
139
|
+
} | {
|
|
140
|
+
readonly type: "grammar";
|
|
141
|
+
readonly grammar: {
|
|
142
|
+
readonly syntax: "lark" | "regex";
|
|
143
|
+
readonly definition: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly cache_control?: {
|
|
148
|
+
readonly type: "ephemeral";
|
|
149
|
+
readonly ttl?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
})[] | undefined;
|
|
126
152
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
127
153
|
readonly type: "function";
|
|
128
154
|
readonly function: {
|
|
129
155
|
readonly name: string;
|
|
130
156
|
};
|
|
157
|
+
} | {
|
|
158
|
+
readonly type: "custom";
|
|
159
|
+
readonly custom: {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
};
|
|
131
162
|
} | undefined;
|
|
132
163
|
readonly stream: true;
|
|
133
164
|
readonly stream_options?: {
|
|
@@ -248,6 +279,6 @@ export declare const chat: (modelID: string | ModelID) => import("../schema/opti
|
|
|
248
279
|
readonly requestID?: string | undefined;
|
|
249
280
|
readonly userID?: string | undefined;
|
|
250
281
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
251
|
-
export declare const model: ProviderPackage.
|
|
252
|
-
export declare const imageModel: (modelID: string, settings
|
|
282
|
+
export declare const model: ProviderPackage.Model<Settings, ChatOptionsInput>;
|
|
283
|
+
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("./zai.js").ZAIImageOptions>;
|
|
253
284
|
export * as ZAI from "./zai.js";
|
package/dist/providers/zai.js
CHANGED
|
@@ -44,7 +44,7 @@ export const imageModel = (modelID, settings) => {
|
|
|
44
44
|
const input = config(settings);
|
|
45
45
|
return configure(input).image(modelID, input.providerOptions);
|
|
46
46
|
};
|
|
47
|
-
function config({ apiKey, baseURL, body, headers, ...providerOptions }) {
|
|
47
|
+
function config({ apiKey, baseURL, body, headers, ...providerOptions } = {}) {
|
|
48
48
|
return {
|
|
49
49
|
apiKey,
|
|
50
50
|
baseURL,
|
package/dist/route/auth.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare function header(name: string): (source: Secret | Credential) => D
|
|
|
45
45
|
export declare function header(name: string, source: Secret | Credential): Definition;
|
|
46
46
|
export declare function bearerHeader(name: string): (source: Secret | Credential) => Definition;
|
|
47
47
|
export declare function bearerHeader(name: string, source: Secret | Credential): Definition;
|
|
48
|
-
/** `Authorization: <scheme> <secret>` for providers whose scheme is not `Bearer`, such as
|
|
48
|
+
/** `Authorization: <scheme> <secret>` for providers whose scheme is not `Bearer`, such as Deepgram's `Token`. */
|
|
49
49
|
export declare function scheme(name: string): (source: Secret | Credential) => Definition;
|
|
50
50
|
export declare function scheme(name: string, source: Secret | Credential): Definition;
|
|
51
51
|
export declare const toEffect: (input: Definition) => (authInput: AuthInput) => Effect.Effect<Headers.Headers, AIError>;
|
|
@@ -52,18 +52,16 @@ export interface Started<Token> {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* A follow-up call's inputs: the decoded token and the auth headers the route sent, so a protocol can attach them
|
|
55
|
-
* to output URLs that require the same credentials to download (Veo).
|
|
56
|
-
* route's executor, for URLs that expire too soon to hand back (BFL).
|
|
55
|
+
* to output URLs that require the same credentials to download (Veo).
|
|
57
56
|
*/
|
|
58
57
|
export interface PollContext<Token> {
|
|
59
58
|
readonly token: Token;
|
|
60
59
|
readonly auth: Record<string, string>;
|
|
61
|
-
readonly materialize: (asset: Media.Asset) => Effect.Effect<Media.Asset, AIError>;
|
|
62
60
|
}
|
|
63
61
|
/**
|
|
64
62
|
* Submit, then poll. `start` posts the body to the route endpoint; `status`, `result`, and `cancel` are follow-up
|
|
65
63
|
* calls addressed by the token. Paths are relative to the route base URL unless the provider hands back absolute
|
|
66
|
-
* URLs
|
|
64
|
+
* URLs, in which case they are used verbatim. `result` is always its own GET: providers that
|
|
67
65
|
* return the output inside the status body (Veo, xAI, Runway) point `result.path` at the status path and decode the
|
|
68
66
|
* same document, so `Generation.await` and `Video.resume(...).await()` behave identically everywhere.
|
|
69
67
|
*/
|
package/dist/route/media.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
2
|
import { Auth } from "./auth.js";
|
|
3
3
|
import { Endpoint } from "./endpoint.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { Interface } from "./executor-service.js";
|
|
5
5
|
import { MediaProtocol } from "./media-protocol.js";
|
|
6
6
|
import { Generation } from "../generation.js";
|
|
7
7
|
import { AIError, HttpOptions, ProviderID, type ProviderOptions } from "../schema/index.js";
|
package/dist/route/media.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Duration, Effect, Schedule, Schema, Stream } from "effect";
|
|
|
2
2
|
import { Headers, HttpClientRequest } from "effect/http";
|
|
3
3
|
import { Auth } from "./auth.js";
|
|
4
4
|
import { Endpoint } from "./endpoint.js";
|
|
5
|
-
import { RequestExecutorService } from "./executor-service.js";
|
|
6
5
|
import { RequestExecutor } from "./executor.js";
|
|
7
6
|
import { MediaProtocol } from "./media-protocol.js";
|
|
8
7
|
import { Generation, isTerminal } from "../generation.js";
|
|
@@ -61,10 +60,9 @@ export const queued = (input) => {
|
|
|
61
60
|
// A protocol producing a token its own codec rejects is a programmer defect, not a provider error.
|
|
62
61
|
const encodeToken = Schema.encodeSync(protocol.token);
|
|
63
62
|
const generationRoute = (token, http, execute) => {
|
|
64
|
-
const materialize = (asset) => asset.materialize().pipe(Effect.provideService(RequestExecutorService, { execute }));
|
|
65
63
|
// Only the GET exchange retries: a decoded terminal failure (`output.ended`) can be a `ProviderInternal` too, and
|
|
66
64
|
// re-reading it would spin until the caller's deadline.
|
|
67
|
-
const poll = (operation) => transport.call("GET", operation.path(token), http, execute).pipe(Effect.retry({ schedule: READ_RETRY, while: isRetryable }), Effect.flatMap((sent) => operation.decode(sent.response, { token, auth: sent.auth
|
|
65
|
+
const poll = (operation) => transport.call("GET", operation.path(token), http, execute).pipe(Effect.retry({ schedule: READ_RETRY, while: isRetryable }), Effect.flatMap((sent) => operation.decode(sent.response, { token, auth: sent.auth })));
|
|
68
66
|
const status = poll(protocol.status);
|
|
69
67
|
const cancel = protocol.cancel;
|
|
70
68
|
const send = cancel === undefined
|
|
@@ -178,7 +176,7 @@ const makeTransport = (input) => {
|
|
|
178
176
|
}),
|
|
179
177
|
/** Bodiless follow-up call (status, result, cancel) with the same auth and headers as `submit`. */
|
|
180
178
|
call: (method, path, http, execute) => {
|
|
181
|
-
// Provider-issued absolute URLs
|
|
179
|
+
// Provider-issued absolute URLs are used as-is; everything else resolves against the base.
|
|
182
180
|
const url = withQuery(/^https?:\/\//.test(path) ? new URL(path) : baseURL(path), http?.query);
|
|
183
181
|
for (const [key, value] of Object.entries(input.endpoint.query ?? {}))
|
|
184
182
|
url.searchParams.set(key, value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode/schema/tool";
|
|
3
|
-
import { CacheHint, GenerationOptions, HttpOptions, type LanguageModel, ReasoningEffort } from "./options.js";
|
|
3
|
+
import { CacheHint, GenerationOptions, HttpOptions, JsonSchema, type LanguageModel, ReasoningEffort } from "./options.js";
|
|
4
4
|
import { Media } from "../media.js";
|
|
5
5
|
export declare const MessageRole: Schema.Literals<readonly ["system", "user", "assistant", "tool"]>;
|
|
6
6
|
export type MessageRole = Schema.Schema.Type<typeof MessageRole>;
|
|
@@ -598,11 +598,34 @@ export declare namespace Message {
|
|
|
598
598
|
}) => Message;
|
|
599
599
|
const tool: (result: ToolResultPart | Parameters<typeof ToolResultPart.make>[0]) => Message;
|
|
600
600
|
}
|
|
601
|
+
/**
|
|
602
|
+
* Raw-text wire encoding for a tool with exactly one required string parameter. Models that accept the format
|
|
603
|
+
* write that parameter's value directly instead of JSON arguments; calls still decode to the normal object input.
|
|
604
|
+
*/
|
|
605
|
+
export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
|
|
606
|
+
readonly type: Schema.Literal<"text">;
|
|
607
|
+
}>, Schema.Struct<{
|
|
608
|
+
readonly type: Schema.Literal<"regex">;
|
|
609
|
+
readonly pattern: Schema.String;
|
|
610
|
+
}>, Schema.Struct<{
|
|
611
|
+
readonly type: Schema.Literal<"lark">;
|
|
612
|
+
readonly grammar: Schema.String;
|
|
613
|
+
}>]>;
|
|
614
|
+
export type Freeform = Schema.Schema.Type<typeof Freeform>;
|
|
601
615
|
declare const toolDefinitionFields: {
|
|
602
616
|
name: Schema.String;
|
|
603
617
|
description: Schema.String;
|
|
604
618
|
inputSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
605
619
|
outputSchema: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
620
|
+
freeform: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
621
|
+
readonly type: Schema.Literal<"text">;
|
|
622
|
+
}>, Schema.Struct<{
|
|
623
|
+
readonly type: Schema.Literal<"regex">;
|
|
624
|
+
readonly pattern: Schema.String;
|
|
625
|
+
}>, Schema.Struct<{
|
|
626
|
+
readonly type: Schema.Literal<"lark">;
|
|
627
|
+
readonly grammar: Schema.String;
|
|
628
|
+
}>]>>;
|
|
606
629
|
cache: Schema.optional<typeof CacheHint>;
|
|
607
630
|
metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
608
631
|
native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
@@ -613,6 +636,15 @@ declare const ToolDefinition_base: Schema.Class<ToolDefinition, Schema.Struct<{
|
|
|
613
636
|
readonly description: Schema.String;
|
|
614
637
|
readonly inputSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
615
638
|
readonly outputSchema: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
639
|
+
readonly freeform: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
640
|
+
readonly type: Schema.Literal<"text">;
|
|
641
|
+
}>, Schema.Struct<{
|
|
642
|
+
readonly type: Schema.Literal<"regex">;
|
|
643
|
+
readonly pattern: Schema.String;
|
|
644
|
+
}>, Schema.Struct<{
|
|
645
|
+
readonly type: Schema.Literal<"lark">;
|
|
646
|
+
readonly grammar: Schema.String;
|
|
647
|
+
}>]>>;
|
|
616
648
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
617
649
|
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
618
650
|
readonly native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
@@ -625,6 +657,8 @@ export declare namespace ToolDefinition {
|
|
|
625
657
|
type Input = ToolDefinition | ToolDefinitionInput;
|
|
626
658
|
/** Normalize tool definition input into the canonical `ToolDefinition` class. */
|
|
627
659
|
const make: (input: Input) => ToolDefinition;
|
|
660
|
+
/** The parameter a freeform call fills: the input schema's only property, when it is a required string. */
|
|
661
|
+
const freeformField: (schema: JsonSchema) => string | undefined;
|
|
628
662
|
}
|
|
629
663
|
export type ToolNamespace = {
|
|
630
664
|
readonly type: "namespace";
|
package/dist/schema/messages.js
CHANGED
|
@@ -202,11 +202,21 @@ export class Message extends Schema.Class("LLM.Message")({
|
|
|
202
202
|
Message.effort = (input) => Message.make({ role: "system", content: [{ type: "effort", effort: input.effort, previous: input.previous }] });
|
|
203
203
|
Message.tool = (result) => Message.make({ role: "tool", content: ["type" in result ? result : ToolResultPart.make(result)] });
|
|
204
204
|
})(Message || (Message = {}));
|
|
205
|
+
/**
|
|
206
|
+
* Raw-text wire encoding for a tool with exactly one required string parameter. Models that accept the format
|
|
207
|
+
* write that parameter's value directly instead of JSON arguments; calls still decode to the normal object input.
|
|
208
|
+
*/
|
|
209
|
+
export const Freeform = Schema.Union([
|
|
210
|
+
Schema.Struct({ type: Schema.Literal("text") }),
|
|
211
|
+
Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }),
|
|
212
|
+
Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }),
|
|
213
|
+
]).annotate({ identifier: "LLM.Freeform" });
|
|
205
214
|
const toolDefinitionFields = {
|
|
206
215
|
name: Schema.String,
|
|
207
216
|
description: Schema.String,
|
|
208
217
|
inputSchema: JsonSchema,
|
|
209
218
|
outputSchema: Schema.optional(JsonSchema),
|
|
219
|
+
freeform: Schema.optional(Freeform),
|
|
210
220
|
cache: Schema.optional(CacheHint),
|
|
211
221
|
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
212
222
|
native: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
@@ -222,6 +232,16 @@ export class ToolDefinition extends Schema.Class("LLM.ToolDefinition")({
|
|
|
222
232
|
(function (ToolDefinition) {
|
|
223
233
|
/** Normalize tool definition input into the canonical `ToolDefinition` class. */
|
|
224
234
|
ToolDefinition.make = (input) => (input instanceof ToolDefinition ? input : new ToolDefinition(input));
|
|
235
|
+
/** The parameter a freeform call fills: the input schema's only property, when it is a required string. */
|
|
236
|
+
ToolDefinition.freeformField = (schema) => {
|
|
237
|
+
const properties = Object.entries(Schema.is(JsonSchema)(schema.properties) ? schema.properties : {});
|
|
238
|
+
if (properties.length !== 1)
|
|
239
|
+
return undefined;
|
|
240
|
+
const [name, property] = properties[0];
|
|
241
|
+
if (!Schema.is(JsonSchema)(property) || property.type !== "string")
|
|
242
|
+
return undefined;
|
|
243
|
+
return Array.isArray(schema.required) && schema.required.includes(name) ? name : undefined;
|
|
244
|
+
};
|
|
225
245
|
})(ToolDefinition || (ToolDefinition = {}));
|
|
226
246
|
export const ToolNamespace = withStatics(Schema.Struct({
|
|
227
247
|
type: Schema.Literal("namespace"),
|
package/dist/speech-client.d.ts
CHANGED
|
@@ -8,6 +8,54 @@ export declare class SpeechClientService extends SpeechClientService_base {
|
|
|
8
8
|
export declare const Service: typeof SpeechClientService;
|
|
9
9
|
export type Service = SpeechClientService;
|
|
10
10
|
export declare const SpeechClient: {
|
|
11
|
+
readonly responseEvents: (response: SpeechResponse) => readonly ({
|
|
12
|
+
readonly type: "audio-delta";
|
|
13
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
14
|
+
} | {
|
|
15
|
+
readonly type: "timestamps";
|
|
16
|
+
readonly items: readonly {
|
|
17
|
+
readonly text: string;
|
|
18
|
+
readonly startSeconds: number;
|
|
19
|
+
readonly endSeconds: number;
|
|
20
|
+
}[];
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: "generation-queued";
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly position?: number | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
readonly type: "generation-progress";
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly progress?: number | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "finish";
|
|
31
|
+
readonly audio: import("./media.js").Asset;
|
|
32
|
+
readonly usage?: {
|
|
33
|
+
readonly type: "seconds";
|
|
34
|
+
readonly seconds: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "characters";
|
|
37
|
+
readonly characters: number;
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "credits";
|
|
40
|
+
readonly credits: number;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "compute";
|
|
43
|
+
readonly seconds: number;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "tokens";
|
|
46
|
+
readonly input?: number | undefined;
|
|
47
|
+
readonly output?: number | undefined;
|
|
48
|
+
readonly total?: number | undefined;
|
|
49
|
+
readonly details?: {
|
|
50
|
+
readonly [x: string]: unknown;
|
|
51
|
+
} | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
readonly providerMetadata?: {
|
|
54
|
+
readonly [x: string]: {
|
|
55
|
+
readonly [x: string]: unknown;
|
|
56
|
+
};
|
|
57
|
+
} | undefined;
|
|
58
|
+
})[];
|
|
11
59
|
readonly layer: import("effect/Layer").Layer<SpeechClientService, never, import("./route.js").RequestExecutorService>;
|
|
12
60
|
readonly generate: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<SpeechResponse, import("./effect.js").AIError, SpeechClientService>;
|
|
13
61
|
readonly stream: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<{
|