@opencode/ai 2.0.21 → 2.0.23
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 +61 -1
- package/dist/cache-policy.js +10 -2
- package/dist/llm.d.ts +4 -0
- package/dist/promise.d.ts +8 -0
- package/dist/protocols/alibaba-chat.d.ts +7 -3
- package/dist/protocols/alibaba-chat.js +2 -1
- package/dist/protocols/alibaba-responses.d.ts +16 -12
- package/dist/protocols/alibaba-responses.js +3 -5
- package/dist/protocols/anthropic-messages.js +58 -51
- package/dist/protocols/bedrock-converse.js +33 -4
- package/dist/protocols/cartesia-speech.js +3 -3
- package/dist/protocols/cohere-chat.d.ts +178 -0
- package/dist/protocols/cohere-chat.js +299 -0
- package/dist/protocols/elevenlabs-speech.js +3 -3
- package/dist/protocols/gemini.d.ts +2 -2
- package/dist/protocols/gemini.js +3 -3
- package/dist/protocols/google-interactions.d.ts +236 -0
- package/dist/protocols/google-interactions.js +478 -0
- package/dist/protocols/google-speech.js +1 -1
- package/dist/protocols/google-transcription.js +1 -1
- package/dist/protocols/index.d.ts +2 -0
- package/dist/protocols/index.js +2 -0
- package/dist/protocols/meta-responses.d.ts +31 -58
- package/dist/protocols/meta-responses.js +8 -27
- package/dist/protocols/mistral-chat.d.ts +24 -9
- package/dist/protocols/mistral-chat.js +22 -10
- package/dist/protocols/open-responses.d.ts +410 -91
- package/dist/protocols/open-responses.js +25 -15
- package/dist/protocols/openai-chat.d.ts +409 -5
- package/dist/protocols/openai-chat.js +27 -26
- package/dist/protocols/openai-compatible-chat.d.ts +1 -1
- package/dist/protocols/openai-compatible-responses.d.ts +16 -4
- package/dist/protocols/openai-images.js +2 -2
- package/dist/protocols/openai-responses.d.ts +87 -223
- package/dist/protocols/openai-responses.js +10 -16
- package/dist/protocols/openai-speech.js +1 -1
- package/dist/protocols/openai-transcription.js +1 -1
- package/dist/protocols/shared.js +2 -2
- package/dist/protocols/stability-images.js +1 -1
- package/dist/protocols/utils/bedrock-media.js +2 -2
- package/dist/protocols/utils/cache.d.ts +5 -0
- package/dist/protocols/utils/cache.js +9 -1
- package/dist/protocols/utils/responses-checkpoint.js +2 -2
- package/dist/protocols/utils/responses-hosted-tools.js +1 -1
- package/dist/protocols/utils/tool-stream.d.ts +12 -0
- package/dist/protocols/utils/tool-stream.js +15 -7
- package/dist/protocols/venice-chat.d.ts +280 -0
- package/dist/protocols/venice-chat.js +283 -0
- package/dist/protocols/xai-responses.d.ts +18 -21
- package/dist/protocols/xai-responses.js +2 -8
- package/dist/protocols/zai-chat.d.ts +7 -3
- package/dist/protocols/zai-chat.js +6 -3
- package/dist/provider-error.js +27 -7
- package/dist/providers/alibaba.d.ts +17 -13
- package/dist/providers/amazon-bedrock/mantle/messages.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/messages.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +301 -9
- package/dist/providers/amazon-bedrock-mantle.js +28 -3
- package/dist/providers/azure.d.ts +13 -61
- package/dist/providers/baseten.d.ts +2 -2
- package/dist/providers/cerebras.d.ts +2 -2
- package/dist/providers/cloudflare-ai-gateway.d.ts +14 -62
- package/dist/providers/cloudflare-workers-ai.d.ts +2 -2
- package/dist/providers/cohere/chat.d.ts +4 -0
- package/dist/providers/cohere/chat.js +8 -0
- package/dist/providers/cohere.d.ts +395 -0
- package/dist/providers/cohere.js +48 -0
- package/dist/providers/deepinfra.d.ts +2 -2
- package/dist/providers/deepseek.d.ts +2 -2
- package/dist/providers/digitalocean.d.ts +469 -0
- package/dist/providers/digitalocean.js +53 -0
- package/dist/providers/fireworks.d.ts +2 -2
- package/dist/providers/google/interactions.d.ts +7 -0
- package/dist/providers/google/interactions.js +8 -0
- package/dist/providers/google-vertex-chat.d.ts +1 -1
- package/dist/providers/google-vertex-messages.js +1 -1
- package/dist/providers/google-vertex-responses.d.ts +16 -4
- package/dist/providers/google-vertex.d.ts +1 -1
- package/dist/providers/google.d.ts +95 -4
- package/dist/providers/google.js +8 -1
- package/dist/providers/groq.d.ts +8 -4
- package/dist/providers/groq.js +1 -1
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +3 -0
- package/dist/providers/meta.d.ts +15 -28
- package/dist/providers/minimax.d.ts +17 -5
- package/dist/providers/mistral.d.ts +10 -4
- package/dist/providers/moonshot.d.ts +17 -5
- package/dist/providers/openai-compatible-responses.d.ts +16 -4
- package/dist/providers/openai-compatible.d.ts +1 -1
- package/dist/providers/openai-options.d.ts +1 -1
- package/dist/providers/openai.d.ts +7 -31
- package/dist/providers/openrouter.d.ts +9 -5
- package/dist/providers/openrouter.js +1 -13
- package/dist/providers/togetherai.d.ts +2 -2
- package/dist/providers/venice.d.ts +183 -0
- package/dist/providers/venice.js +38 -0
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/zai-coding-plan.d.ts +17 -5
- package/dist/providers/zai.d.ts +1 -1
- package/dist/route/client.d.ts +4 -0
- package/dist/route/client.js +2 -5
- package/dist/route/executor.js +13 -6
- package/dist/route/framing.js +23 -23
- package/dist/route/transport/http.d.ts +2 -1
- package/dist/route/transport/http.js +28 -6
- package/dist/schema/events.d.ts +176 -0
- package/dist/schema/events.js +4 -0
- package/dist/schema/options.d.ts +11 -0
- package/dist/schema/options.js +15 -2
- package/dist/testing.d.ts +32 -0
- package/dist/tool-history.js +17 -3
- package/package.json +3 -3
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
5
|
+
import { Protocol } from "../route/protocol.js";
|
|
6
|
+
import { type ModelID } from "../schema/index.js";
|
|
7
|
+
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
8
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
|
+
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
10
|
+
readonly baseURL?: string;
|
|
11
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
12
|
+
};
|
|
13
|
+
export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
14
|
+
readonly apiKey?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const protocol: Protocol<{
|
|
17
|
+
readonly model: string;
|
|
18
|
+
readonly messages: readonly ({
|
|
19
|
+
readonly role: "system";
|
|
20
|
+
readonly content: string | readonly ({
|
|
21
|
+
readonly type: "text";
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly cache_control?: {
|
|
24
|
+
readonly type: "ephemeral";
|
|
25
|
+
readonly ttl?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "image_url";
|
|
29
|
+
readonly image_url: {
|
|
30
|
+
readonly url: string;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: "file";
|
|
34
|
+
readonly file: {
|
|
35
|
+
readonly filename: string;
|
|
36
|
+
readonly file_data: string;
|
|
37
|
+
};
|
|
38
|
+
})[];
|
|
39
|
+
} | {
|
|
40
|
+
readonly role: "user";
|
|
41
|
+
readonly content: string | readonly ({
|
|
42
|
+
readonly type: "text";
|
|
43
|
+
readonly text: string;
|
|
44
|
+
readonly cache_control?: {
|
|
45
|
+
readonly type: "ephemeral";
|
|
46
|
+
readonly ttl?: string | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "image_url";
|
|
50
|
+
readonly image_url: {
|
|
51
|
+
readonly url: string;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: "file";
|
|
55
|
+
readonly file: {
|
|
56
|
+
readonly filename: string;
|
|
57
|
+
readonly file_data: string;
|
|
58
|
+
};
|
|
59
|
+
})[];
|
|
60
|
+
} | {
|
|
61
|
+
readonly [x: string]: unknown;
|
|
62
|
+
readonly content: string | readonly {
|
|
63
|
+
readonly type: "text";
|
|
64
|
+
readonly text: string;
|
|
65
|
+
readonly cache_control?: {
|
|
66
|
+
readonly type: "ephemeral";
|
|
67
|
+
readonly ttl?: string | undefined;
|
|
68
|
+
} | undefined;
|
|
69
|
+
}[] | null;
|
|
70
|
+
readonly role: "assistant";
|
|
71
|
+
readonly reasoning?: string | undefined;
|
|
72
|
+
readonly reasoning_content?: string | undefined;
|
|
73
|
+
readonly reasoning_text?: string | undefined;
|
|
74
|
+
readonly tool_calls?: readonly {
|
|
75
|
+
readonly function: {
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly arguments: string;
|
|
78
|
+
};
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
readonly extra_content?: {
|
|
82
|
+
readonly google: {
|
|
83
|
+
readonly thought_signature: string;
|
|
84
|
+
};
|
|
85
|
+
} | undefined;
|
|
86
|
+
}[] | undefined;
|
|
87
|
+
readonly reasoning_details?: unknown;
|
|
88
|
+
} | {
|
|
89
|
+
readonly role: "tool";
|
|
90
|
+
readonly tool_call_id: string;
|
|
91
|
+
readonly content: string | readonly {
|
|
92
|
+
readonly type: "text";
|
|
93
|
+
readonly text: string;
|
|
94
|
+
readonly cache_control?: {
|
|
95
|
+
readonly type: "ephemeral";
|
|
96
|
+
readonly ttl?: string | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
})[];
|
|
100
|
+
readonly stream: true;
|
|
101
|
+
readonly max_completion_tokens?: number | undefined;
|
|
102
|
+
readonly max_tokens?: number | undefined;
|
|
103
|
+
readonly tools?: readonly {
|
|
104
|
+
readonly function: {
|
|
105
|
+
readonly description: string;
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly parameters: {
|
|
108
|
+
readonly [x: string]: unknown;
|
|
109
|
+
};
|
|
110
|
+
readonly strict?: boolean | undefined;
|
|
111
|
+
};
|
|
112
|
+
readonly type: "function";
|
|
113
|
+
readonly cache_control?: {
|
|
114
|
+
readonly type: "ephemeral";
|
|
115
|
+
readonly ttl?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}[] | undefined;
|
|
118
|
+
readonly stop?: readonly string[] | undefined;
|
|
119
|
+
readonly temperature?: number | undefined;
|
|
120
|
+
readonly seed?: number | undefined;
|
|
121
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
122
|
+
readonly type: "function";
|
|
123
|
+
readonly function: {
|
|
124
|
+
readonly name: string;
|
|
125
|
+
};
|
|
126
|
+
} | undefined;
|
|
127
|
+
readonly top_p?: number | undefined;
|
|
128
|
+
readonly frequency_penalty?: number | undefined;
|
|
129
|
+
readonly presence_penalty?: number | undefined;
|
|
130
|
+
readonly store?: boolean | undefined;
|
|
131
|
+
readonly prompt_cache_key?: string | undefined;
|
|
132
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
133
|
+
readonly stream_options?: {
|
|
134
|
+
readonly include_usage: boolean;
|
|
135
|
+
} | undefined;
|
|
136
|
+
readonly tool_stream?: boolean | undefined;
|
|
137
|
+
}, string, "[DONE]" | {
|
|
138
|
+
readonly [x: string]: unknown;
|
|
139
|
+
readonly error?: {
|
|
140
|
+
readonly [x: string]: unknown;
|
|
141
|
+
readonly message: string;
|
|
142
|
+
readonly code?: string | number | null | undefined;
|
|
143
|
+
} | null | undefined;
|
|
144
|
+
readonly usage?: {
|
|
145
|
+
readonly [x: string]: unknown;
|
|
146
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
147
|
+
readonly cached_tokens?: number | null | undefined;
|
|
148
|
+
readonly total_tokens?: number | null | undefined;
|
|
149
|
+
readonly prompt_tokens?: number | null | undefined;
|
|
150
|
+
readonly completion_tokens?: number | null | undefined;
|
|
151
|
+
readonly prompt_tokens_details?: {
|
|
152
|
+
readonly [x: string]: unknown;
|
|
153
|
+
readonly cached_tokens?: number | null | undefined;
|
|
154
|
+
readonly cache_write_tokens?: number | null | undefined;
|
|
155
|
+
} | null | undefined;
|
|
156
|
+
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
157
|
+
readonly cache_created_input_tokens?: number | null | undefined;
|
|
158
|
+
readonly completion_tokens_details?: {
|
|
159
|
+
readonly [x: string]: unknown;
|
|
160
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
161
|
+
readonly accepted_prediction_tokens?: number | null | undefined;
|
|
162
|
+
readonly rejected_prediction_tokens?: number | null | undefined;
|
|
163
|
+
} | null | undefined;
|
|
164
|
+
} | null | undefined;
|
|
165
|
+
readonly choices?: readonly {
|
|
166
|
+
readonly [x: string]: unknown;
|
|
167
|
+
readonly delta?: {
|
|
168
|
+
readonly [x: string]: unknown;
|
|
169
|
+
readonly reasoning?: string | null | undefined;
|
|
170
|
+
readonly reasoning_content?: string | null | undefined;
|
|
171
|
+
readonly reasoning_text?: string | null | undefined;
|
|
172
|
+
readonly content?: string | null | undefined;
|
|
173
|
+
readonly refusal?: string | null | undefined;
|
|
174
|
+
readonly tool_calls?: readonly {
|
|
175
|
+
readonly function?: {
|
|
176
|
+
readonly name?: string | null | undefined;
|
|
177
|
+
readonly arguments?: string | null | undefined;
|
|
178
|
+
} | null | undefined;
|
|
179
|
+
readonly id?: string | null | undefined;
|
|
180
|
+
readonly index?: number | null | undefined;
|
|
181
|
+
readonly extra_content?: unknown;
|
|
182
|
+
}[] | null | undefined;
|
|
183
|
+
readonly reasoning_details?: unknown;
|
|
184
|
+
} | null | undefined;
|
|
185
|
+
readonly usage?: {
|
|
186
|
+
readonly [x: string]: unknown;
|
|
187
|
+
readonly cache_read_input_tokens?: number | null | undefined;
|
|
188
|
+
readonly cached_tokens?: number | null | undefined;
|
|
189
|
+
readonly total_tokens?: number | null | undefined;
|
|
190
|
+
readonly prompt_tokens?: number | null | undefined;
|
|
191
|
+
readonly completion_tokens?: number | null | undefined;
|
|
192
|
+
readonly prompt_tokens_details?: {
|
|
193
|
+
readonly [x: string]: unknown;
|
|
194
|
+
readonly cached_tokens?: number | null | undefined;
|
|
195
|
+
readonly cache_write_tokens?: number | null | undefined;
|
|
196
|
+
} | null | undefined;
|
|
197
|
+
readonly prompt_cache_hit_tokens?: number | null | undefined;
|
|
198
|
+
readonly cache_created_input_tokens?: number | null | undefined;
|
|
199
|
+
readonly completion_tokens_details?: {
|
|
200
|
+
readonly [x: string]: unknown;
|
|
201
|
+
readonly reasoning_tokens?: number | null | undefined;
|
|
202
|
+
readonly accepted_prediction_tokens?: number | null | undefined;
|
|
203
|
+
readonly rejected_prediction_tokens?: number | null | undefined;
|
|
204
|
+
} | null | undefined;
|
|
205
|
+
} | null | undefined;
|
|
206
|
+
readonly finish_reason?: string | null | undefined;
|
|
207
|
+
readonly native_finish_reason?: string | null | undefined;
|
|
208
|
+
}[] | null | undefined;
|
|
209
|
+
}, OpenAIChat.ParserState>;
|
|
210
|
+
export declare const route: Route<{
|
|
211
|
+
readonly model: string;
|
|
212
|
+
readonly messages: readonly ({
|
|
213
|
+
readonly role: "system";
|
|
214
|
+
readonly content: string | readonly ({
|
|
215
|
+
readonly type: "text";
|
|
216
|
+
readonly text: string;
|
|
217
|
+
readonly cache_control?: {
|
|
218
|
+
readonly type: "ephemeral";
|
|
219
|
+
readonly ttl?: string | undefined;
|
|
220
|
+
} | undefined;
|
|
221
|
+
} | {
|
|
222
|
+
readonly type: "image_url";
|
|
223
|
+
readonly image_url: {
|
|
224
|
+
readonly url: string;
|
|
225
|
+
};
|
|
226
|
+
} | {
|
|
227
|
+
readonly type: "file";
|
|
228
|
+
readonly file: {
|
|
229
|
+
readonly filename: string;
|
|
230
|
+
readonly file_data: string;
|
|
231
|
+
};
|
|
232
|
+
})[];
|
|
233
|
+
} | {
|
|
234
|
+
readonly role: "user";
|
|
235
|
+
readonly content: string | readonly ({
|
|
236
|
+
readonly type: "text";
|
|
237
|
+
readonly text: string;
|
|
238
|
+
readonly cache_control?: {
|
|
239
|
+
readonly type: "ephemeral";
|
|
240
|
+
readonly ttl?: string | undefined;
|
|
241
|
+
} | undefined;
|
|
242
|
+
} | {
|
|
243
|
+
readonly type: "image_url";
|
|
244
|
+
readonly image_url: {
|
|
245
|
+
readonly url: string;
|
|
246
|
+
};
|
|
247
|
+
} | {
|
|
248
|
+
readonly type: "file";
|
|
249
|
+
readonly file: {
|
|
250
|
+
readonly filename: string;
|
|
251
|
+
readonly file_data: string;
|
|
252
|
+
};
|
|
253
|
+
})[];
|
|
254
|
+
} | {
|
|
255
|
+
readonly [x: string]: unknown;
|
|
256
|
+
readonly content: string | readonly {
|
|
257
|
+
readonly type: "text";
|
|
258
|
+
readonly text: string;
|
|
259
|
+
readonly cache_control?: {
|
|
260
|
+
readonly type: "ephemeral";
|
|
261
|
+
readonly ttl?: string | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
}[] | null;
|
|
264
|
+
readonly role: "assistant";
|
|
265
|
+
readonly reasoning?: string | undefined;
|
|
266
|
+
readonly reasoning_content?: string | undefined;
|
|
267
|
+
readonly reasoning_text?: string | undefined;
|
|
268
|
+
readonly tool_calls?: readonly {
|
|
269
|
+
readonly function: {
|
|
270
|
+
readonly name: string;
|
|
271
|
+
readonly arguments: string;
|
|
272
|
+
};
|
|
273
|
+
readonly id: string;
|
|
274
|
+
readonly type: "function";
|
|
275
|
+
readonly extra_content?: {
|
|
276
|
+
readonly google: {
|
|
277
|
+
readonly thought_signature: string;
|
|
278
|
+
};
|
|
279
|
+
} | undefined;
|
|
280
|
+
}[] | undefined;
|
|
281
|
+
readonly reasoning_details?: unknown;
|
|
282
|
+
} | {
|
|
283
|
+
readonly role: "tool";
|
|
284
|
+
readonly tool_call_id: string;
|
|
285
|
+
readonly content: string | readonly {
|
|
286
|
+
readonly type: "text";
|
|
287
|
+
readonly text: string;
|
|
288
|
+
readonly cache_control?: {
|
|
289
|
+
readonly type: "ephemeral";
|
|
290
|
+
readonly ttl?: string | undefined;
|
|
291
|
+
} | undefined;
|
|
292
|
+
}[];
|
|
293
|
+
})[];
|
|
294
|
+
readonly stream: true;
|
|
295
|
+
readonly max_completion_tokens?: number | undefined;
|
|
296
|
+
readonly max_tokens?: number | undefined;
|
|
297
|
+
readonly tools?: readonly {
|
|
298
|
+
readonly function: {
|
|
299
|
+
readonly description: string;
|
|
300
|
+
readonly name: string;
|
|
301
|
+
readonly parameters: {
|
|
302
|
+
readonly [x: string]: unknown;
|
|
303
|
+
};
|
|
304
|
+
readonly strict?: boolean | undefined;
|
|
305
|
+
};
|
|
306
|
+
readonly type: "function";
|
|
307
|
+
readonly cache_control?: {
|
|
308
|
+
readonly type: "ephemeral";
|
|
309
|
+
readonly ttl?: string | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
}[] | undefined;
|
|
312
|
+
readonly stop?: readonly string[] | undefined;
|
|
313
|
+
readonly temperature?: number | undefined;
|
|
314
|
+
readonly seed?: number | undefined;
|
|
315
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
316
|
+
readonly type: "function";
|
|
317
|
+
readonly function: {
|
|
318
|
+
readonly name: string;
|
|
319
|
+
};
|
|
320
|
+
} | undefined;
|
|
321
|
+
readonly top_p?: number | undefined;
|
|
322
|
+
readonly frequency_penalty?: number | undefined;
|
|
323
|
+
readonly presence_penalty?: number | undefined;
|
|
324
|
+
readonly store?: boolean | undefined;
|
|
325
|
+
readonly prompt_cache_key?: string | undefined;
|
|
326
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
327
|
+
readonly stream_options?: {
|
|
328
|
+
readonly include_usage: boolean;
|
|
329
|
+
} | undefined;
|
|
330
|
+
readonly tool_stream?: boolean | undefined;
|
|
331
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
332
|
+
export declare const routes: Route<{
|
|
333
|
+
readonly model: string;
|
|
334
|
+
readonly messages: readonly ({
|
|
335
|
+
readonly role: "system";
|
|
336
|
+
readonly content: string | readonly ({
|
|
337
|
+
readonly type: "text";
|
|
338
|
+
readonly text: string;
|
|
339
|
+
readonly cache_control?: {
|
|
340
|
+
readonly type: "ephemeral";
|
|
341
|
+
readonly ttl?: string | undefined;
|
|
342
|
+
} | undefined;
|
|
343
|
+
} | {
|
|
344
|
+
readonly type: "image_url";
|
|
345
|
+
readonly image_url: {
|
|
346
|
+
readonly url: string;
|
|
347
|
+
};
|
|
348
|
+
} | {
|
|
349
|
+
readonly type: "file";
|
|
350
|
+
readonly file: {
|
|
351
|
+
readonly filename: string;
|
|
352
|
+
readonly file_data: string;
|
|
353
|
+
};
|
|
354
|
+
})[];
|
|
355
|
+
} | {
|
|
356
|
+
readonly role: "user";
|
|
357
|
+
readonly content: string | readonly ({
|
|
358
|
+
readonly type: "text";
|
|
359
|
+
readonly text: string;
|
|
360
|
+
readonly cache_control?: {
|
|
361
|
+
readonly type: "ephemeral";
|
|
362
|
+
readonly ttl?: string | undefined;
|
|
363
|
+
} | undefined;
|
|
364
|
+
} | {
|
|
365
|
+
readonly type: "image_url";
|
|
366
|
+
readonly image_url: {
|
|
367
|
+
readonly url: string;
|
|
368
|
+
};
|
|
369
|
+
} | {
|
|
370
|
+
readonly type: "file";
|
|
371
|
+
readonly file: {
|
|
372
|
+
readonly filename: string;
|
|
373
|
+
readonly file_data: string;
|
|
374
|
+
};
|
|
375
|
+
})[];
|
|
376
|
+
} | {
|
|
377
|
+
readonly [x: string]: unknown;
|
|
378
|
+
readonly content: string | readonly {
|
|
379
|
+
readonly type: "text";
|
|
380
|
+
readonly text: string;
|
|
381
|
+
readonly cache_control?: {
|
|
382
|
+
readonly type: "ephemeral";
|
|
383
|
+
readonly ttl?: string | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
}[] | null;
|
|
386
|
+
readonly role: "assistant";
|
|
387
|
+
readonly reasoning?: string | undefined;
|
|
388
|
+
readonly reasoning_content?: string | undefined;
|
|
389
|
+
readonly reasoning_text?: string | undefined;
|
|
390
|
+
readonly tool_calls?: readonly {
|
|
391
|
+
readonly function: {
|
|
392
|
+
readonly name: string;
|
|
393
|
+
readonly arguments: string;
|
|
394
|
+
};
|
|
395
|
+
readonly id: string;
|
|
396
|
+
readonly type: "function";
|
|
397
|
+
readonly extra_content?: {
|
|
398
|
+
readonly google: {
|
|
399
|
+
readonly thought_signature: string;
|
|
400
|
+
};
|
|
401
|
+
} | undefined;
|
|
402
|
+
}[] | undefined;
|
|
403
|
+
readonly reasoning_details?: unknown;
|
|
404
|
+
} | {
|
|
405
|
+
readonly role: "tool";
|
|
406
|
+
readonly tool_call_id: string;
|
|
407
|
+
readonly content: string | readonly {
|
|
408
|
+
readonly type: "text";
|
|
409
|
+
readonly text: string;
|
|
410
|
+
readonly cache_control?: {
|
|
411
|
+
readonly type: "ephemeral";
|
|
412
|
+
readonly ttl?: string | undefined;
|
|
413
|
+
} | undefined;
|
|
414
|
+
}[];
|
|
415
|
+
})[];
|
|
416
|
+
readonly stream: true;
|
|
417
|
+
readonly max_completion_tokens?: number | undefined;
|
|
418
|
+
readonly max_tokens?: number | undefined;
|
|
419
|
+
readonly tools?: readonly {
|
|
420
|
+
readonly function: {
|
|
421
|
+
readonly description: string;
|
|
422
|
+
readonly name: string;
|
|
423
|
+
readonly parameters: {
|
|
424
|
+
readonly [x: string]: unknown;
|
|
425
|
+
};
|
|
426
|
+
readonly strict?: boolean | undefined;
|
|
427
|
+
};
|
|
428
|
+
readonly type: "function";
|
|
429
|
+
readonly cache_control?: {
|
|
430
|
+
readonly type: "ephemeral";
|
|
431
|
+
readonly ttl?: string | undefined;
|
|
432
|
+
} | undefined;
|
|
433
|
+
}[] | undefined;
|
|
434
|
+
readonly stop?: readonly string[] | undefined;
|
|
435
|
+
readonly temperature?: number | undefined;
|
|
436
|
+
readonly seed?: number | undefined;
|
|
437
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
438
|
+
readonly type: "function";
|
|
439
|
+
readonly function: {
|
|
440
|
+
readonly name: string;
|
|
441
|
+
};
|
|
442
|
+
} | undefined;
|
|
443
|
+
readonly top_p?: number | undefined;
|
|
444
|
+
readonly frequency_penalty?: number | undefined;
|
|
445
|
+
readonly presence_penalty?: number | undefined;
|
|
446
|
+
readonly store?: boolean | undefined;
|
|
447
|
+
readonly prompt_cache_key?: string | undefined;
|
|
448
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
449
|
+
readonly stream_options?: {
|
|
450
|
+
readonly include_usage: boolean;
|
|
451
|
+
} | undefined;
|
|
452
|
+
readonly tool_stream?: boolean | undefined;
|
|
453
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
454
|
+
export declare const configure: (input?: LanguageModelOptions) => {
|
|
455
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
456
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
457
|
+
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
458
|
+
};
|
|
459
|
+
export declare const provider: {
|
|
460
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
461
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
462
|
+
configure: (input?: LanguageModelOptions) => {
|
|
463
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
464
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
465
|
+
configure: /*elided*/ any;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
469
|
+
export * as DigitalOcean from "./digitalocean.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
2
|
+
import { cacheControl } from "../protocols/utils/cache.js";
|
|
3
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
4
|
+
import { Route } from "../route/client.js";
|
|
5
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
6
|
+
import { Protocol } from "../route/protocol.js";
|
|
7
|
+
import { ProviderID } from "../schema/index.js";
|
|
8
|
+
export const id = ProviderID.make("digitalocean");
|
|
9
|
+
const baseURL = "https://inference.do-ai.run/v1";
|
|
10
|
+
export const protocol = Protocol.make({
|
|
11
|
+
id: "digitalocean-chat",
|
|
12
|
+
body: {
|
|
13
|
+
schema: OpenAIChat.protocol.body.schema,
|
|
14
|
+
from: (request) => OpenAIChat.fromRequest(request, { cacheControl: cacheControl() }),
|
|
15
|
+
},
|
|
16
|
+
stream: OpenAIChat.protocol.stream,
|
|
17
|
+
});
|
|
18
|
+
export const route = Route.make({
|
|
19
|
+
id: "digitalocean",
|
|
20
|
+
provider: id,
|
|
21
|
+
providerMetadataKey: "digitalocean",
|
|
22
|
+
protocol,
|
|
23
|
+
endpoint: Endpoint.path("/chat/completions", { baseURL }),
|
|
24
|
+
framing: OpenAIChat.framing,
|
|
25
|
+
});
|
|
26
|
+
export const routes = [route];
|
|
27
|
+
export const configure = (input = {}) => {
|
|
28
|
+
const { apiKey: _apiKey, auth: _auth, baseURL: endpoint, ...defaults } = input;
|
|
29
|
+
const configured = route.with({
|
|
30
|
+
...defaults,
|
|
31
|
+
endpoint: { baseURL: endpoint ?? baseURL },
|
|
32
|
+
auth: AuthOptions.bearer(input, ["DIGITALOCEAN_ACCESS_TOKEN", "DIGITALOCEAN_API_KEY", "DO_INFERENCE_API_KEY"]),
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
model: (modelID) => configured.model({
|
|
37
|
+
id: modelID,
|
|
38
|
+
compatibility: {
|
|
39
|
+
supportsPromptCacheKey: true,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
configure,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export const provider = configure();
|
|
46
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
47
|
+
apiKey,
|
|
48
|
+
baseURL,
|
|
49
|
+
headers,
|
|
50
|
+
http: { body },
|
|
51
|
+
providerOptions,
|
|
52
|
+
}).model(modelID);
|
|
53
|
+
export * as DigitalOcean from "./digitalocean.js";
|
|
@@ -126,9 +126,9 @@ export declare const route: Route<{
|
|
|
126
126
|
readonly top_p?: number | undefined;
|
|
127
127
|
readonly frequency_penalty?: number | undefined;
|
|
128
128
|
readonly presence_penalty?: number | undefined;
|
|
129
|
+
readonly store?: boolean | undefined;
|
|
129
130
|
readonly prompt_cache_key?: string | undefined;
|
|
130
131
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
131
|
-
readonly store?: boolean | undefined;
|
|
132
132
|
readonly stream_options?: {
|
|
133
133
|
readonly include_usage: boolean;
|
|
134
134
|
} | undefined;
|
|
@@ -248,9 +248,9 @@ export declare const routes: Route<{
|
|
|
248
248
|
readonly top_p?: number | undefined;
|
|
249
249
|
readonly frequency_penalty?: number | undefined;
|
|
250
250
|
readonly presence_penalty?: number | undefined;
|
|
251
|
+
readonly store?: boolean | undefined;
|
|
251
252
|
readonly prompt_cache_key?: string | undefined;
|
|
252
253
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
253
|
-
readonly store?: boolean | undefined;
|
|
254
254
|
readonly stream_options?: {
|
|
255
255
|
readonly include_usage: boolean;
|
|
256
256
|
} | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../../provider-package.js";
|
|
2
|
+
import type { GoogleInteractions } from "../../protocols/google-interactions.js";
|
|
3
|
+
export type Settings = ProviderPackage.Settings & GoogleInteractions.ProviderOptionsInput & {
|
|
4
|
+
readonly apiKey?: string;
|
|
5
|
+
readonly baseURL?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const model: ProviderPackage.Definition<Settings, GoogleInteractions.ProviderOptionsInput>["model"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { configure } from "../google.js";
|
|
2
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
3
|
+
apiKey,
|
|
4
|
+
baseURL,
|
|
5
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
6
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
7
|
+
providerOptions,
|
|
8
|
+
}).interactions(modelID);
|
|
@@ -131,9 +131,9 @@ export declare const routes: Route<{
|
|
|
131
131
|
readonly top_p?: number | undefined;
|
|
132
132
|
readonly frequency_penalty?: number | undefined;
|
|
133
133
|
readonly presence_penalty?: number | undefined;
|
|
134
|
+
readonly store?: boolean | undefined;
|
|
134
135
|
readonly prompt_cache_key?: string | undefined;
|
|
135
136
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
136
|
-
readonly store?: boolean | undefined;
|
|
137
137
|
readonly stream_options?: {
|
|
138
138
|
readonly include_usage: boolean;
|
|
139
139
|
} | undefined;
|
|
@@ -12,7 +12,7 @@ export const id = ProviderID.make("google-vertex");
|
|
|
12
12
|
const route = Route.make({
|
|
13
13
|
id: "google-vertex-messages",
|
|
14
14
|
provider: id,
|
|
15
|
-
providerMetadataKey: "
|
|
15
|
+
providerMetadataKey: "vertex",
|
|
16
16
|
protocol: Protocol.make({
|
|
17
17
|
id: AnthropicMessages.protocol.id,
|
|
18
18
|
body: {
|
|
@@ -55,6 +55,15 @@ export declare const routes: Route<{
|
|
|
55
55
|
readonly error?: unknown;
|
|
56
56
|
readonly arguments?: string | undefined;
|
|
57
57
|
readonly server_label?: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
readonly type: "configuration_update";
|
|
60
|
+
readonly reasoning: {
|
|
61
|
+
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
readonly [x: string]: unknown;
|
|
65
|
+
readonly type: string;
|
|
66
|
+
readonly id: string;
|
|
58
67
|
} | {
|
|
59
68
|
readonly type: "reasoning";
|
|
60
69
|
readonly summary: readonly {
|
|
@@ -142,7 +151,10 @@ export declare const routes: Route<{
|
|
|
142
151
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
143
152
|
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
144
153
|
} | undefined;
|
|
145
|
-
readonly tools?: readonly {
|
|
154
|
+
readonly tools?: readonly ({
|
|
155
|
+
readonly [x: string]: unknown;
|
|
156
|
+
readonly type: string;
|
|
157
|
+
} | {
|
|
146
158
|
readonly type: "function";
|
|
147
159
|
readonly description: string;
|
|
148
160
|
readonly name: string;
|
|
@@ -150,7 +162,7 @@ export declare const routes: Route<{
|
|
|
150
162
|
readonly [x: string]: unknown;
|
|
151
163
|
};
|
|
152
164
|
readonly strict?: boolean | undefined;
|
|
153
|
-
}[] | undefined;
|
|
165
|
+
})[] | undefined;
|
|
154
166
|
readonly text?: {
|
|
155
167
|
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
156
168
|
} | undefined;
|
|
@@ -170,9 +182,10 @@ export declare const routes: Route<{
|
|
|
170
182
|
readonly top_p?: number | undefined;
|
|
171
183
|
readonly frequency_penalty?: number | undefined;
|
|
172
184
|
readonly presence_penalty?: number | undefined;
|
|
185
|
+
readonly store?: boolean | undefined;
|
|
186
|
+
readonly max_output_tokens?: number | undefined;
|
|
173
187
|
readonly prompt_cache_key?: string | undefined;
|
|
174
188
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
175
|
-
readonly store?: boolean | undefined;
|
|
176
189
|
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
177
190
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
178
191
|
readonly stream_options?: {
|
|
@@ -180,7 +193,6 @@ export declare const routes: Route<{
|
|
|
180
193
|
} | undefined;
|
|
181
194
|
readonly safety_identifier?: string | undefined;
|
|
182
195
|
readonly top_logprobs?: number | undefined;
|
|
183
|
-
readonly max_output_tokens?: number | undefined;
|
|
184
196
|
readonly max_tool_calls?: number | undefined;
|
|
185
197
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
186
198
|
export declare const configure: (input?: Config) => {
|
|
@@ -77,7 +77,7 @@ export declare const routes: Route<{
|
|
|
77
77
|
readonly serviceTier?: string | undefined;
|
|
78
78
|
readonly toolConfig?: {
|
|
79
79
|
readonly functionCallingConfig: {
|
|
80
|
-
readonly mode: "
|
|
80
|
+
readonly mode: "NONE" | "AUTO" | "ANY";
|
|
81
81
|
readonly allowedFunctionNames?: readonly string[] | undefined;
|
|
82
82
|
};
|
|
83
83
|
} | undefined;
|