@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,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;
|