@opencode/ai 2.0.22 → 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 +1 -0
- package/dist/protocols/alibaba-chat.d.ts +3 -3
- package/dist/protocols/alibaba-responses.d.ts +16 -12
- package/dist/protocols/alibaba-responses.js +3 -5
- package/dist/protocols/anthropic-messages.js +44 -39
- package/dist/protocols/bedrock-converse.js +3 -3
- 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 +406 -91
- package/dist/protocols/open-responses.js +25 -15
- package/dist/protocols/openai-chat.d.ts +401 -5
- package/dist/protocols/openai-chat.js +18 -21
- 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 +6 -13
- 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/responses-checkpoint.js +2 -2
- package/dist/protocols/utils/responses-hosted-tools.js +1 -1
- 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 +3 -3
- package/dist/provider-error.js +7 -1
- 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 +5 -5
- 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-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 +4 -4
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +2 -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 +5 -5
- 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.js +2 -5
- package/dist/route/framing.js +23 -23
- package/package.json +3 -3
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { CohereChat } from "../protocols/cohere-chat.js";
|
|
2
|
+
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
3
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import { type ModelID, type OpenString } from "../schema/index.js";
|
|
5
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
export type ChatOptionsInput = {
|
|
8
|
+
readonly reasoningEffort?: OpenString<"none" | "high">;
|
|
9
|
+
};
|
|
10
|
+
export type ProviderOptions = CohereChat.ProviderOptionsInput & ChatOptionsInput;
|
|
11
|
+
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
12
|
+
readonly baseURL?: string;
|
|
13
|
+
readonly providerOptions?: ProviderOptions;
|
|
14
|
+
};
|
|
15
|
+
export type Settings<Options = CohereChat.ProviderOptionsInput> = ProviderPackage.Settings & Options & {
|
|
16
|
+
readonly apiKey?: string;
|
|
17
|
+
readonly baseURL?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const route: Route<{
|
|
20
|
+
readonly model: string;
|
|
21
|
+
readonly messages: readonly {
|
|
22
|
+
readonly role: "tool" | "system" | "user" | "assistant";
|
|
23
|
+
readonly content?: string | readonly ({
|
|
24
|
+
readonly type: "text";
|
|
25
|
+
readonly text: string;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: "thinking";
|
|
28
|
+
readonly thinking: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "image_url";
|
|
31
|
+
readonly image_url: {
|
|
32
|
+
readonly url: string;
|
|
33
|
+
};
|
|
34
|
+
})[] | undefined;
|
|
35
|
+
readonly tool_calls?: readonly {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
readonly function: {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly arguments: string;
|
|
41
|
+
};
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
readonly tool_call_id?: string | undefined;
|
|
44
|
+
readonly tool_plan?: string | undefined;
|
|
45
|
+
}[];
|
|
46
|
+
readonly stream: true;
|
|
47
|
+
readonly max_tokens?: number | undefined;
|
|
48
|
+
readonly tools?: readonly {
|
|
49
|
+
readonly type: "function";
|
|
50
|
+
readonly function: {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly parameters: unknown;
|
|
53
|
+
readonly description?: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
readonly temperature?: number | undefined;
|
|
57
|
+
readonly seed?: number | undefined;
|
|
58
|
+
readonly thinking?: {
|
|
59
|
+
readonly type: string;
|
|
60
|
+
readonly token_budget?: number | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
readonly tool_choice?: "NONE" | "REQUIRED" | undefined;
|
|
63
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
64
|
+
readonly p?: number | undefined;
|
|
65
|
+
readonly k?: number | undefined;
|
|
66
|
+
readonly frequency_penalty?: number | undefined;
|
|
67
|
+
readonly presence_penalty?: number | undefined;
|
|
68
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
69
|
+
export declare const chatRoute: Route<{
|
|
70
|
+
readonly model: string;
|
|
71
|
+
readonly messages: readonly ({
|
|
72
|
+
readonly role: "system";
|
|
73
|
+
readonly content: string | readonly ({
|
|
74
|
+
readonly type: "text";
|
|
75
|
+
readonly text: string;
|
|
76
|
+
readonly cache_control?: {
|
|
77
|
+
readonly type: "ephemeral";
|
|
78
|
+
readonly ttl?: string | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
} | {
|
|
81
|
+
readonly type: "image_url";
|
|
82
|
+
readonly image_url: {
|
|
83
|
+
readonly url: string;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: "file";
|
|
87
|
+
readonly file: {
|
|
88
|
+
readonly filename: string;
|
|
89
|
+
readonly file_data: string;
|
|
90
|
+
};
|
|
91
|
+
})[];
|
|
92
|
+
} | {
|
|
93
|
+
readonly role: "user";
|
|
94
|
+
readonly content: string | readonly ({
|
|
95
|
+
readonly type: "text";
|
|
96
|
+
readonly text: string;
|
|
97
|
+
readonly cache_control?: {
|
|
98
|
+
readonly type: "ephemeral";
|
|
99
|
+
readonly ttl?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
readonly type: "image_url";
|
|
103
|
+
readonly image_url: {
|
|
104
|
+
readonly url: string;
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
readonly type: "file";
|
|
108
|
+
readonly file: {
|
|
109
|
+
readonly filename: string;
|
|
110
|
+
readonly file_data: string;
|
|
111
|
+
};
|
|
112
|
+
})[];
|
|
113
|
+
} | {
|
|
114
|
+
readonly [x: string]: unknown;
|
|
115
|
+
readonly content: string | readonly {
|
|
116
|
+
readonly type: "text";
|
|
117
|
+
readonly text: string;
|
|
118
|
+
readonly cache_control?: {
|
|
119
|
+
readonly type: "ephemeral";
|
|
120
|
+
readonly ttl?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}[] | null;
|
|
123
|
+
readonly role: "assistant";
|
|
124
|
+
readonly reasoning?: string | undefined;
|
|
125
|
+
readonly reasoning_content?: string | undefined;
|
|
126
|
+
readonly reasoning_text?: string | undefined;
|
|
127
|
+
readonly tool_calls?: readonly {
|
|
128
|
+
readonly function: {
|
|
129
|
+
readonly name: string;
|
|
130
|
+
readonly arguments: string;
|
|
131
|
+
};
|
|
132
|
+
readonly id: string;
|
|
133
|
+
readonly type: "function";
|
|
134
|
+
readonly extra_content?: {
|
|
135
|
+
readonly google: {
|
|
136
|
+
readonly thought_signature: string;
|
|
137
|
+
};
|
|
138
|
+
} | undefined;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
readonly reasoning_details?: unknown;
|
|
141
|
+
} | {
|
|
142
|
+
readonly role: "tool";
|
|
143
|
+
readonly tool_call_id: string;
|
|
144
|
+
readonly content: string | readonly {
|
|
145
|
+
readonly type: "text";
|
|
146
|
+
readonly text: string;
|
|
147
|
+
readonly cache_control?: {
|
|
148
|
+
readonly type: "ephemeral";
|
|
149
|
+
readonly ttl?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
}[];
|
|
152
|
+
})[];
|
|
153
|
+
readonly stream: true;
|
|
154
|
+
readonly max_completion_tokens?: number | undefined;
|
|
155
|
+
readonly max_tokens?: number | undefined;
|
|
156
|
+
readonly tools?: readonly {
|
|
157
|
+
readonly function: {
|
|
158
|
+
readonly description: string;
|
|
159
|
+
readonly name: string;
|
|
160
|
+
readonly parameters: {
|
|
161
|
+
readonly [x: string]: unknown;
|
|
162
|
+
};
|
|
163
|
+
readonly strict?: boolean | undefined;
|
|
164
|
+
};
|
|
165
|
+
readonly type: "function";
|
|
166
|
+
readonly cache_control?: {
|
|
167
|
+
readonly type: "ephemeral";
|
|
168
|
+
readonly ttl?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
readonly stop?: readonly string[] | undefined;
|
|
172
|
+
readonly temperature?: number | undefined;
|
|
173
|
+
readonly seed?: number | undefined;
|
|
174
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
175
|
+
readonly type: "function";
|
|
176
|
+
readonly function: {
|
|
177
|
+
readonly name: string;
|
|
178
|
+
};
|
|
179
|
+
} | undefined;
|
|
180
|
+
readonly top_p?: number | undefined;
|
|
181
|
+
readonly frequency_penalty?: number | undefined;
|
|
182
|
+
readonly presence_penalty?: number | undefined;
|
|
183
|
+
readonly store?: boolean | undefined;
|
|
184
|
+
readonly prompt_cache_key?: string | undefined;
|
|
185
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
186
|
+
readonly stream_options?: {
|
|
187
|
+
readonly include_usage: boolean;
|
|
188
|
+
} | undefined;
|
|
189
|
+
readonly tool_stream?: boolean | undefined;
|
|
190
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
191
|
+
export declare const routes: (Route<{
|
|
192
|
+
readonly model: string;
|
|
193
|
+
readonly messages: readonly {
|
|
194
|
+
readonly role: "tool" | "system" | "user" | "assistant";
|
|
195
|
+
readonly content?: string | readonly ({
|
|
196
|
+
readonly type: "text";
|
|
197
|
+
readonly text: string;
|
|
198
|
+
} | {
|
|
199
|
+
readonly type: "thinking";
|
|
200
|
+
readonly thinking: string;
|
|
201
|
+
} | {
|
|
202
|
+
readonly type: "image_url";
|
|
203
|
+
readonly image_url: {
|
|
204
|
+
readonly url: string;
|
|
205
|
+
};
|
|
206
|
+
})[] | undefined;
|
|
207
|
+
readonly tool_calls?: readonly {
|
|
208
|
+
readonly id: string;
|
|
209
|
+
readonly type: "function";
|
|
210
|
+
readonly function: {
|
|
211
|
+
readonly name: string;
|
|
212
|
+
readonly arguments: string;
|
|
213
|
+
};
|
|
214
|
+
}[] | undefined;
|
|
215
|
+
readonly tool_call_id?: string | undefined;
|
|
216
|
+
readonly tool_plan?: string | undefined;
|
|
217
|
+
}[];
|
|
218
|
+
readonly stream: true;
|
|
219
|
+
readonly max_tokens?: number | undefined;
|
|
220
|
+
readonly tools?: readonly {
|
|
221
|
+
readonly type: "function";
|
|
222
|
+
readonly function: {
|
|
223
|
+
readonly name: string;
|
|
224
|
+
readonly parameters: unknown;
|
|
225
|
+
readonly description?: string | undefined;
|
|
226
|
+
};
|
|
227
|
+
}[] | undefined;
|
|
228
|
+
readonly temperature?: number | undefined;
|
|
229
|
+
readonly seed?: number | undefined;
|
|
230
|
+
readonly thinking?: {
|
|
231
|
+
readonly type: string;
|
|
232
|
+
readonly token_budget?: number | undefined;
|
|
233
|
+
} | undefined;
|
|
234
|
+
readonly tool_choice?: "NONE" | "REQUIRED" | undefined;
|
|
235
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
236
|
+
readonly p?: number | undefined;
|
|
237
|
+
readonly k?: number | undefined;
|
|
238
|
+
readonly frequency_penalty?: number | undefined;
|
|
239
|
+
readonly presence_penalty?: number | undefined;
|
|
240
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
|
|
241
|
+
readonly model: string;
|
|
242
|
+
readonly messages: readonly ({
|
|
243
|
+
readonly role: "system";
|
|
244
|
+
readonly content: string | readonly ({
|
|
245
|
+
readonly type: "text";
|
|
246
|
+
readonly text: string;
|
|
247
|
+
readonly cache_control?: {
|
|
248
|
+
readonly type: "ephemeral";
|
|
249
|
+
readonly ttl?: string | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
} | {
|
|
252
|
+
readonly type: "image_url";
|
|
253
|
+
readonly image_url: {
|
|
254
|
+
readonly url: string;
|
|
255
|
+
};
|
|
256
|
+
} | {
|
|
257
|
+
readonly type: "file";
|
|
258
|
+
readonly file: {
|
|
259
|
+
readonly filename: string;
|
|
260
|
+
readonly file_data: string;
|
|
261
|
+
};
|
|
262
|
+
})[];
|
|
263
|
+
} | {
|
|
264
|
+
readonly role: "user";
|
|
265
|
+
readonly content: string | readonly ({
|
|
266
|
+
readonly type: "text";
|
|
267
|
+
readonly text: string;
|
|
268
|
+
readonly cache_control?: {
|
|
269
|
+
readonly type: "ephemeral";
|
|
270
|
+
readonly ttl?: string | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
} | {
|
|
273
|
+
readonly type: "image_url";
|
|
274
|
+
readonly image_url: {
|
|
275
|
+
readonly url: string;
|
|
276
|
+
};
|
|
277
|
+
} | {
|
|
278
|
+
readonly type: "file";
|
|
279
|
+
readonly file: {
|
|
280
|
+
readonly filename: string;
|
|
281
|
+
readonly file_data: string;
|
|
282
|
+
};
|
|
283
|
+
})[];
|
|
284
|
+
} | {
|
|
285
|
+
readonly [x: string]: unknown;
|
|
286
|
+
readonly content: string | readonly {
|
|
287
|
+
readonly type: "text";
|
|
288
|
+
readonly text: string;
|
|
289
|
+
readonly cache_control?: {
|
|
290
|
+
readonly type: "ephemeral";
|
|
291
|
+
readonly ttl?: string | undefined;
|
|
292
|
+
} | undefined;
|
|
293
|
+
}[] | null;
|
|
294
|
+
readonly role: "assistant";
|
|
295
|
+
readonly reasoning?: string | undefined;
|
|
296
|
+
readonly reasoning_content?: string | undefined;
|
|
297
|
+
readonly reasoning_text?: string | undefined;
|
|
298
|
+
readonly tool_calls?: readonly {
|
|
299
|
+
readonly function: {
|
|
300
|
+
readonly name: string;
|
|
301
|
+
readonly arguments: string;
|
|
302
|
+
};
|
|
303
|
+
readonly id: string;
|
|
304
|
+
readonly type: "function";
|
|
305
|
+
readonly extra_content?: {
|
|
306
|
+
readonly google: {
|
|
307
|
+
readonly thought_signature: string;
|
|
308
|
+
};
|
|
309
|
+
} | undefined;
|
|
310
|
+
}[] | undefined;
|
|
311
|
+
readonly reasoning_details?: unknown;
|
|
312
|
+
} | {
|
|
313
|
+
readonly role: "tool";
|
|
314
|
+
readonly tool_call_id: string;
|
|
315
|
+
readonly content: string | readonly {
|
|
316
|
+
readonly type: "text";
|
|
317
|
+
readonly text: string;
|
|
318
|
+
readonly cache_control?: {
|
|
319
|
+
readonly type: "ephemeral";
|
|
320
|
+
readonly ttl?: string | undefined;
|
|
321
|
+
} | undefined;
|
|
322
|
+
}[];
|
|
323
|
+
})[];
|
|
324
|
+
readonly stream: true;
|
|
325
|
+
readonly max_completion_tokens?: number | undefined;
|
|
326
|
+
readonly max_tokens?: number | undefined;
|
|
327
|
+
readonly tools?: readonly {
|
|
328
|
+
readonly function: {
|
|
329
|
+
readonly description: string;
|
|
330
|
+
readonly name: string;
|
|
331
|
+
readonly parameters: {
|
|
332
|
+
readonly [x: string]: unknown;
|
|
333
|
+
};
|
|
334
|
+
readonly strict?: boolean | undefined;
|
|
335
|
+
};
|
|
336
|
+
readonly type: "function";
|
|
337
|
+
readonly cache_control?: {
|
|
338
|
+
readonly type: "ephemeral";
|
|
339
|
+
readonly ttl?: string | undefined;
|
|
340
|
+
} | undefined;
|
|
341
|
+
}[] | undefined;
|
|
342
|
+
readonly stop?: readonly string[] | undefined;
|
|
343
|
+
readonly temperature?: number | undefined;
|
|
344
|
+
readonly seed?: number | undefined;
|
|
345
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
346
|
+
readonly type: "function";
|
|
347
|
+
readonly function: {
|
|
348
|
+
readonly name: string;
|
|
349
|
+
};
|
|
350
|
+
} | undefined;
|
|
351
|
+
readonly top_p?: number | undefined;
|
|
352
|
+
readonly frequency_penalty?: number | undefined;
|
|
353
|
+
readonly presence_penalty?: number | undefined;
|
|
354
|
+
readonly store?: boolean | undefined;
|
|
355
|
+
readonly prompt_cache_key?: string | undefined;
|
|
356
|
+
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
357
|
+
readonly stream_options?: {
|
|
358
|
+
readonly include_usage: boolean;
|
|
359
|
+
} | undefined;
|
|
360
|
+
readonly tool_stream?: boolean | undefined;
|
|
361
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>)[];
|
|
362
|
+
export declare const configure: (input?: LanguageModelOptions) => {
|
|
363
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
364
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
365
|
+
readonly thinking?: {
|
|
366
|
+
readonly type?: "enabled" | "disabled" | undefined;
|
|
367
|
+
readonly tokenBudget?: number | undefined;
|
|
368
|
+
} | undefined;
|
|
369
|
+
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
370
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
371
|
+
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
372
|
+
};
|
|
373
|
+
export declare const provider: {
|
|
374
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
375
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
376
|
+
readonly thinking?: {
|
|
377
|
+
readonly type?: "enabled" | "disabled" | undefined;
|
|
378
|
+
readonly tokenBudget?: number | undefined;
|
|
379
|
+
} | undefined;
|
|
380
|
+
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
381
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
382
|
+
configure: (input?: LanguageModelOptions) => {
|
|
383
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
384
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
385
|
+
readonly thinking?: {
|
|
386
|
+
readonly type?: "enabled" | "disabled" | undefined;
|
|
387
|
+
readonly tokenBudget?: number | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
390
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ChatOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
391
|
+
configure: /*elided*/ any;
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
export declare const model: ProviderPackage.Definition<Settings, CohereChat.ProviderOptionsInput>["model"];
|
|
395
|
+
export * as Cohere from "./cohere.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CohereChat } from "../protocols/cohere-chat.js";
|
|
2
|
+
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
3
|
+
import { Route } from "../route/client.js";
|
|
4
|
+
import { Endpoint } from "../route/endpoint.js";
|
|
5
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
6
|
+
import { ProviderID } from "../schema/index.js";
|
|
7
|
+
export const id = ProviderID.make("cohere");
|
|
8
|
+
const COMPATIBILITY_BASE_URL = "https://api.cohere.ai/compatibility/v1";
|
|
9
|
+
export const route = CohereChat.route;
|
|
10
|
+
export const chatRoute = Route.make({
|
|
11
|
+
id: "cohere-chat-completions",
|
|
12
|
+
provider: id,
|
|
13
|
+
providerMetadataKey: "cohere",
|
|
14
|
+
protocol: OpenAIChat.protocol,
|
|
15
|
+
endpoint: Endpoint.path("/chat/completions", { baseURL: COMPATIBILITY_BASE_URL }),
|
|
16
|
+
framing: OpenAIChat.framing,
|
|
17
|
+
});
|
|
18
|
+
export const routes = [route, chatRoute];
|
|
19
|
+
export const configure = (input = {}) => {
|
|
20
|
+
const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input;
|
|
21
|
+
const auth = AuthOptions.bearer(input, "COHERE_API_KEY");
|
|
22
|
+
const native = route.with({ ...defaults, auth, endpoint: { baseURL: baseURL ?? CohereChat.DEFAULT_BASE_URL } });
|
|
23
|
+
const chat = chatRoute.with({ ...defaults, auth, endpoint: { baseURL: baseURL ?? COMPATIBILITY_BASE_URL } });
|
|
24
|
+
return {
|
|
25
|
+
id,
|
|
26
|
+
model: (modelID) => native.model({ id: modelID }),
|
|
27
|
+
chat: (modelID) => chat.model({
|
|
28
|
+
id: modelID,
|
|
29
|
+
compatibility: {
|
|
30
|
+
maxTokensField: "max_tokens",
|
|
31
|
+
supportsStore: false,
|
|
32
|
+
supportsUsageInStreaming: true,
|
|
33
|
+
reasoningField: "reasoning_content",
|
|
34
|
+
supportsStrictMode: false,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
configure,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export const provider = configure();
|
|
41
|
+
export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => configure({
|
|
42
|
+
apiKey,
|
|
43
|
+
baseURL,
|
|
44
|
+
headers,
|
|
45
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
46
|
+
providerOptions,
|
|
47
|
+
}).model(modelID);
|
|
48
|
+
export * as Cohere from "./cohere.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;
|
|
@@ -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;
|
|
@@ -127,9 +127,9 @@ export declare const protocol: Protocol<{
|
|
|
127
127
|
readonly top_p?: number | undefined;
|
|
128
128
|
readonly frequency_penalty?: number | undefined;
|
|
129
129
|
readonly presence_penalty?: number | undefined;
|
|
130
|
+
readonly store?: boolean | undefined;
|
|
130
131
|
readonly prompt_cache_key?: string | undefined;
|
|
131
132
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
132
|
-
readonly store?: boolean | undefined;
|
|
133
133
|
readonly stream_options?: {
|
|
134
134
|
readonly include_usage: boolean;
|
|
135
135
|
} | undefined;
|
|
@@ -145,9 +145,9 @@ export declare const protocol: Protocol<{
|
|
|
145
145
|
readonly [x: string]: unknown;
|
|
146
146
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
147
147
|
readonly cached_tokens?: number | null | undefined;
|
|
148
|
+
readonly total_tokens?: number | null | undefined;
|
|
148
149
|
readonly prompt_tokens?: number | null | undefined;
|
|
149
150
|
readonly completion_tokens?: number | null | undefined;
|
|
150
|
-
readonly total_tokens?: number | null | undefined;
|
|
151
151
|
readonly prompt_tokens_details?: {
|
|
152
152
|
readonly [x: string]: unknown;
|
|
153
153
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -186,9 +186,9 @@ export declare const protocol: Protocol<{
|
|
|
186
186
|
readonly [x: string]: unknown;
|
|
187
187
|
readonly cache_read_input_tokens?: number | null | undefined;
|
|
188
188
|
readonly cached_tokens?: number | null | undefined;
|
|
189
|
+
readonly total_tokens?: number | null | undefined;
|
|
189
190
|
readonly prompt_tokens?: number | null | undefined;
|
|
190
191
|
readonly completion_tokens?: number | null | undefined;
|
|
191
|
-
readonly total_tokens?: number | null | undefined;
|
|
192
192
|
readonly prompt_tokens_details?: {
|
|
193
193
|
readonly [x: string]: unknown;
|
|
194
194
|
readonly cached_tokens?: number | null | undefined;
|
|
@@ -321,9 +321,9 @@ export declare const route: Route<{
|
|
|
321
321
|
readonly top_p?: number | undefined;
|
|
322
322
|
readonly frequency_penalty?: number | undefined;
|
|
323
323
|
readonly presence_penalty?: number | undefined;
|
|
324
|
+
readonly store?: boolean | undefined;
|
|
324
325
|
readonly prompt_cache_key?: string | undefined;
|
|
325
326
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
326
|
-
readonly store?: boolean | undefined;
|
|
327
327
|
readonly stream_options?: {
|
|
328
328
|
readonly include_usage: boolean;
|
|
329
329
|
} | undefined;
|
|
@@ -443,9 +443,9 @@ export declare const routes: Route<{
|
|
|
443
443
|
readonly top_p?: number | undefined;
|
|
444
444
|
readonly frequency_penalty?: number | undefined;
|
|
445
445
|
readonly presence_penalty?: number | undefined;
|
|
446
|
+
readonly store?: boolean | undefined;
|
|
446
447
|
readonly prompt_cache_key?: string | undefined;
|
|
447
448
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
448
|
-
readonly store?: boolean | undefined;
|
|
449
449
|
readonly stream_options?: {
|
|
450
450
|
readonly include_usage: boolean;
|
|
451
451
|
} | undefined;
|
|
@@ -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;
|
|
@@ -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;
|