@opencode/ai 2.0.22 → 2.0.24
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 +13 -9
- package/dist/protocols/alibaba-chat.d.ts +3 -3
- package/dist/protocols/alibaba-messages.d.ts +3 -0
- package/dist/protocols/alibaba-responses.d.ts +19 -12
- package/dist/protocols/alibaba-responses.js +3 -5
- package/dist/protocols/anthropic-messages.d.ts +3 -0
- package/dist/protocols/anthropic-messages.js +53 -48
- 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-messages.d.ts +3 -0
- package/dist/protocols/meta-responses.d.ts +34 -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 +424 -103
- package/dist/protocols/open-responses.js +30 -20
- 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 +90 -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/gateway-protocol.d.ts +17 -0
- package/dist/protocols/utils/gateway-protocol.js +57 -0
- 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 +21 -21
- package/dist/protocols/xai-responses.js +2 -8
- package/dist/protocols/zai-chat.d.ts +3 -3
- package/dist/protocols/zai-messages.d.ts +3 -0
- 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-messages.js +1 -0
- 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/vercel-ai-gateway/chat.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/chat.js +1 -0
- package/dist/providers/vercel-ai-gateway/messages.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/messages.js +1 -0
- package/dist/providers/vercel-ai-gateway/responses.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/responses.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +91 -9
- package/dist/providers/vercel-ai-gateway.js +161 -21
- 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
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
2
2
|
import type { ProviderPackage } from "../provider-package.js";
|
|
3
|
+
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
4
|
import { type Credentials } from "../protocols/utils/bedrock-auth.js";
|
|
4
5
|
import { type ModelID } from "../schema/index.js";
|
|
5
6
|
import { type OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
7
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type
|
|
8
|
+
export type OpenAIOptionsInput = OpenAIProviderOptionsInput;
|
|
9
|
+
export type MessagesOptionsInput = AnthropicMessages.ProviderOptionsInput;
|
|
10
|
+
export type Config = Omit<RouteDefaultsInput, "providerOptions"> & {
|
|
8
11
|
/** Bedrock API key. Falls back to `AWS_BEARER_TOKEN_BEDROCK`; bearer auth takes precedence over SigV4. */
|
|
9
12
|
readonly apiKey?: string;
|
|
10
13
|
/** `sigv4` ignores `apiKey` fallbacks from the environment; `bearer` requires a token. */
|
|
@@ -15,9 +18,9 @@ export type Config = RouteDefaultsInput & {
|
|
|
15
18
|
/** Shared config profile for the default credential chain. */
|
|
16
19
|
readonly profile?: string;
|
|
17
20
|
readonly region?: string;
|
|
18
|
-
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
21
|
+
readonly providerOptions?: OpenAIProviderOptionsInput | AnthropicMessages.ProviderOptionsInput;
|
|
19
22
|
};
|
|
20
|
-
export type Settings = ProviderPackage.Settings &
|
|
23
|
+
export type Settings<Options = OpenAIProviderOptionsInput> = ProviderPackage.Settings & Options & {
|
|
21
24
|
readonly apiKey?: string;
|
|
22
25
|
readonly auth?: "bearer" | "sigv4";
|
|
23
26
|
readonly baseURL?: string;
|
|
@@ -26,7 +29,280 @@ export type Settings = ProviderPackage.Settings & OpenAIProviderOptionsInput & {
|
|
|
26
29
|
readonly region?: string;
|
|
27
30
|
readonly topP?: number;
|
|
28
31
|
};
|
|
32
|
+
export type MessagesSettings = Settings<AnthropicMessages.ProviderOptionsInput>;
|
|
29
33
|
export declare const routes: (Route<{
|
|
34
|
+
readonly max_tokens: number;
|
|
35
|
+
readonly model: string;
|
|
36
|
+
readonly messages: readonly ({
|
|
37
|
+
readonly role: "user";
|
|
38
|
+
readonly content: readonly ({
|
|
39
|
+
readonly type: "text";
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly cache_control?: {
|
|
42
|
+
readonly type: "ephemeral";
|
|
43
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: "image";
|
|
47
|
+
readonly source: {
|
|
48
|
+
readonly type: "base64";
|
|
49
|
+
readonly media_type: string;
|
|
50
|
+
readonly data: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "url";
|
|
53
|
+
readonly url: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "file";
|
|
56
|
+
readonly file_id: string;
|
|
57
|
+
};
|
|
58
|
+
readonly cache_control?: {
|
|
59
|
+
readonly type: "ephemeral";
|
|
60
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
readonly transformations?: {
|
|
63
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: "document";
|
|
67
|
+
readonly source: {
|
|
68
|
+
readonly type: "base64";
|
|
69
|
+
readonly media_type: "application/pdf";
|
|
70
|
+
readonly data: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly type: "text";
|
|
73
|
+
readonly media_type: "text/plain";
|
|
74
|
+
readonly data: string;
|
|
75
|
+
} | {
|
|
76
|
+
readonly type: "url";
|
|
77
|
+
readonly url: string;
|
|
78
|
+
} | {
|
|
79
|
+
readonly type: "file";
|
|
80
|
+
readonly file_id: string;
|
|
81
|
+
};
|
|
82
|
+
readonly title?: string | undefined;
|
|
83
|
+
readonly context?: string | undefined;
|
|
84
|
+
readonly cache_control?: {
|
|
85
|
+
readonly type: "ephemeral";
|
|
86
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
readonly citations?: {
|
|
89
|
+
readonly enabled: boolean;
|
|
90
|
+
} | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
readonly type: "tool_result";
|
|
93
|
+
readonly content: string | readonly ({
|
|
94
|
+
readonly type: "text";
|
|
95
|
+
readonly text: string;
|
|
96
|
+
readonly cache_control?: {
|
|
97
|
+
readonly type: "ephemeral";
|
|
98
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
readonly type: "image";
|
|
102
|
+
readonly source: {
|
|
103
|
+
readonly type: "base64";
|
|
104
|
+
readonly media_type: string;
|
|
105
|
+
readonly data: string;
|
|
106
|
+
} | {
|
|
107
|
+
readonly type: "url";
|
|
108
|
+
readonly url: string;
|
|
109
|
+
} | {
|
|
110
|
+
readonly type: "file";
|
|
111
|
+
readonly file_id: string;
|
|
112
|
+
};
|
|
113
|
+
readonly cache_control?: {
|
|
114
|
+
readonly type: "ephemeral";
|
|
115
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
readonly transformations?: {
|
|
118
|
+
readonly oversized_image?: "error" | "downsize" | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
readonly type: "document";
|
|
122
|
+
readonly source: {
|
|
123
|
+
readonly type: "base64";
|
|
124
|
+
readonly media_type: "application/pdf";
|
|
125
|
+
readonly data: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "text";
|
|
128
|
+
readonly media_type: "text/plain";
|
|
129
|
+
readonly data: string;
|
|
130
|
+
} | {
|
|
131
|
+
readonly type: "url";
|
|
132
|
+
readonly url: string;
|
|
133
|
+
} | {
|
|
134
|
+
readonly type: "file";
|
|
135
|
+
readonly file_id: string;
|
|
136
|
+
};
|
|
137
|
+
readonly title?: string | undefined;
|
|
138
|
+
readonly context?: string | undefined;
|
|
139
|
+
readonly cache_control?: {
|
|
140
|
+
readonly type: "ephemeral";
|
|
141
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
readonly citations?: {
|
|
144
|
+
readonly enabled: boolean;
|
|
145
|
+
} | undefined;
|
|
146
|
+
})[];
|
|
147
|
+
readonly tool_use_id: string;
|
|
148
|
+
readonly cache_control?: {
|
|
149
|
+
readonly type: "ephemeral";
|
|
150
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
151
|
+
} | undefined;
|
|
152
|
+
readonly is_error?: boolean | undefined;
|
|
153
|
+
})[];
|
|
154
|
+
} | {
|
|
155
|
+
readonly role: "assistant";
|
|
156
|
+
readonly content: readonly ({
|
|
157
|
+
readonly type: "text";
|
|
158
|
+
readonly text: string;
|
|
159
|
+
readonly cache_control?: {
|
|
160
|
+
readonly type: "ephemeral";
|
|
161
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
} | {
|
|
164
|
+
readonly id: string;
|
|
165
|
+
readonly type: "tool_use";
|
|
166
|
+
readonly name: string;
|
|
167
|
+
readonly input: unknown;
|
|
168
|
+
readonly cache_control?: {
|
|
169
|
+
readonly type: "ephemeral";
|
|
170
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
171
|
+
} | undefined;
|
|
172
|
+
} | {
|
|
173
|
+
readonly id: string;
|
|
174
|
+
readonly type: "server_tool_use";
|
|
175
|
+
readonly name: string;
|
|
176
|
+
readonly input: unknown;
|
|
177
|
+
readonly cache_control?: {
|
|
178
|
+
readonly type: "ephemeral";
|
|
179
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
} | {
|
|
182
|
+
readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
|
|
183
|
+
readonly content: unknown;
|
|
184
|
+
readonly tool_use_id: string;
|
|
185
|
+
readonly cache_control?: {
|
|
186
|
+
readonly type: "ephemeral";
|
|
187
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
188
|
+
} | undefined;
|
|
189
|
+
} | {
|
|
190
|
+
readonly type: "thinking";
|
|
191
|
+
readonly thinking: string;
|
|
192
|
+
readonly signature: string;
|
|
193
|
+
readonly cache_control?: {
|
|
194
|
+
readonly type: "ephemeral";
|
|
195
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
196
|
+
} | undefined;
|
|
197
|
+
} | {
|
|
198
|
+
readonly data: string;
|
|
199
|
+
readonly type: "redacted_thinking";
|
|
200
|
+
readonly cache_control?: {
|
|
201
|
+
readonly type: "ephemeral";
|
|
202
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
} | {
|
|
205
|
+
readonly type: "compaction";
|
|
206
|
+
readonly content: string | null;
|
|
207
|
+
})[];
|
|
208
|
+
} | {
|
|
209
|
+
readonly content: readonly {
|
|
210
|
+
readonly type: "text";
|
|
211
|
+
readonly text: string;
|
|
212
|
+
readonly cache_control?: {
|
|
213
|
+
readonly type: "ephemeral";
|
|
214
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
215
|
+
} | undefined;
|
|
216
|
+
}[];
|
|
217
|
+
readonly role: "system";
|
|
218
|
+
readonly output_config?: {
|
|
219
|
+
readonly effort: string;
|
|
220
|
+
} | undefined;
|
|
221
|
+
})[];
|
|
222
|
+
readonly stream: true;
|
|
223
|
+
readonly metadata?: {
|
|
224
|
+
readonly user_id?: string | null | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
readonly tools?: readonly {
|
|
227
|
+
readonly description: string;
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly input_schema: {
|
|
230
|
+
readonly [x: string]: unknown;
|
|
231
|
+
};
|
|
232
|
+
readonly cache_control?: {
|
|
233
|
+
readonly type: "ephemeral";
|
|
234
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
}[] | undefined;
|
|
237
|
+
readonly system?: readonly {
|
|
238
|
+
readonly type: "text";
|
|
239
|
+
readonly text: string;
|
|
240
|
+
readonly cache_control?: {
|
|
241
|
+
readonly type: "ephemeral";
|
|
242
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
243
|
+
} | undefined;
|
|
244
|
+
}[] | undefined;
|
|
245
|
+
readonly temperature?: number | undefined;
|
|
246
|
+
readonly thinking?: {
|
|
247
|
+
readonly type: "enabled";
|
|
248
|
+
readonly budget_tokens: number;
|
|
249
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
250
|
+
readonly block_binding?: {
|
|
251
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
252
|
+
} | undefined;
|
|
253
|
+
} | {
|
|
254
|
+
readonly type: "adaptive";
|
|
255
|
+
readonly display?: import("../schema/options.js").OpenString<"summarized" | "omitted"> | undefined;
|
|
256
|
+
readonly block_binding?: {
|
|
257
|
+
readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"error" | "drop_block"> | undefined;
|
|
258
|
+
} | undefined;
|
|
259
|
+
} | {
|
|
260
|
+
readonly type: "disabled";
|
|
261
|
+
} | undefined;
|
|
262
|
+
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
263
|
+
readonly container?: string | {
|
|
264
|
+
readonly id?: string | null | undefined;
|
|
265
|
+
readonly skills?: readonly {
|
|
266
|
+
readonly [x: string]: unknown;
|
|
267
|
+
}[] | null | undefined;
|
|
268
|
+
} | null | undefined;
|
|
269
|
+
readonly inference_geo?: string | null | undefined;
|
|
270
|
+
readonly cache_control?: {
|
|
271
|
+
readonly type: "ephemeral";
|
|
272
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
273
|
+
} | undefined;
|
|
274
|
+
readonly output_config?: {
|
|
275
|
+
readonly format?: {
|
|
276
|
+
readonly type: "json_schema";
|
|
277
|
+
readonly schema: {
|
|
278
|
+
readonly [x: string]: unknown;
|
|
279
|
+
};
|
|
280
|
+
} | null | undefined;
|
|
281
|
+
readonly effort?: string | undefined;
|
|
282
|
+
} | undefined;
|
|
283
|
+
readonly context_management?: {
|
|
284
|
+
readonly edits: readonly {
|
|
285
|
+
readonly type: "compact_20260112";
|
|
286
|
+
readonly instructions?: string | undefined;
|
|
287
|
+
readonly trigger?: {
|
|
288
|
+
readonly type: "input_tokens";
|
|
289
|
+
readonly value: number;
|
|
290
|
+
} | undefined;
|
|
291
|
+
readonly pause_after_compaction?: boolean | undefined;
|
|
292
|
+
}[];
|
|
293
|
+
} | undefined;
|
|
294
|
+
readonly tool_choice?: {
|
|
295
|
+
readonly type: "auto" | "none" | "any";
|
|
296
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
297
|
+
} | {
|
|
298
|
+
readonly type: "tool";
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly disable_parallel_tool_use?: boolean | undefined;
|
|
301
|
+
} | undefined;
|
|
302
|
+
readonly top_p?: number | undefined;
|
|
303
|
+
readonly top_k?: number | undefined;
|
|
304
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
305
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
|
|
30
306
|
readonly model: string;
|
|
31
307
|
readonly messages: readonly ({
|
|
32
308
|
readonly role: "system";
|
|
@@ -140,9 +416,9 @@ export declare const routes: (Route<{
|
|
|
140
416
|
readonly top_p?: number | undefined;
|
|
141
417
|
readonly frequency_penalty?: number | undefined;
|
|
142
418
|
readonly presence_penalty?: number | undefined;
|
|
419
|
+
readonly store?: boolean | undefined;
|
|
143
420
|
readonly prompt_cache_key?: string | undefined;
|
|
144
421
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
145
|
-
readonly store?: boolean | undefined;
|
|
146
422
|
readonly stream_options?: {
|
|
147
423
|
readonly include_usage: boolean;
|
|
148
424
|
} | undefined;
|
|
@@ -185,6 +461,15 @@ export declare const routes: (Route<{
|
|
|
185
461
|
readonly error?: unknown;
|
|
186
462
|
readonly arguments?: string | undefined;
|
|
187
463
|
readonly server_label?: string | undefined;
|
|
464
|
+
} | {
|
|
465
|
+
readonly type: "configuration_update";
|
|
466
|
+
readonly reasoning: {
|
|
467
|
+
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
468
|
+
};
|
|
469
|
+
} | {
|
|
470
|
+
readonly [x: string]: unknown;
|
|
471
|
+
readonly type: string;
|
|
472
|
+
readonly id: string;
|
|
188
473
|
} | {
|
|
189
474
|
readonly type: "reasoning";
|
|
190
475
|
readonly summary: readonly {
|
|
@@ -272,7 +557,10 @@ export declare const routes: (Route<{
|
|
|
272
557
|
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
273
558
|
readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
274
559
|
} | undefined;
|
|
275
|
-
readonly tools?: readonly {
|
|
560
|
+
readonly tools?: readonly ({
|
|
561
|
+
readonly [x: string]: unknown;
|
|
562
|
+
readonly type: string;
|
|
563
|
+
} | {
|
|
276
564
|
readonly type: "function";
|
|
277
565
|
readonly description: string;
|
|
278
566
|
readonly name: string;
|
|
@@ -280,7 +568,7 @@ export declare const routes: (Route<{
|
|
|
280
568
|
readonly [x: string]: unknown;
|
|
281
569
|
};
|
|
282
570
|
readonly strict?: boolean | undefined;
|
|
283
|
-
}[] | undefined;
|
|
571
|
+
})[] | undefined;
|
|
284
572
|
readonly text?: {
|
|
285
573
|
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
286
574
|
} | undefined;
|
|
@@ -300,9 +588,10 @@ export declare const routes: (Route<{
|
|
|
300
588
|
readonly top_p?: number | undefined;
|
|
301
589
|
readonly frequency_penalty?: number | undefined;
|
|
302
590
|
readonly presence_penalty?: number | undefined;
|
|
591
|
+
readonly store?: boolean | undefined;
|
|
592
|
+
readonly max_output_tokens?: number | undefined;
|
|
303
593
|
readonly prompt_cache_key?: string | undefined;
|
|
304
594
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
305
|
-
readonly store?: boolean | undefined;
|
|
306
595
|
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
307
596
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
308
597
|
readonly stream_options?: {
|
|
@@ -310,13 +599,13 @@ export declare const routes: (Route<{
|
|
|
310
599
|
} | undefined;
|
|
311
600
|
readonly safety_identifier?: string | undefined;
|
|
312
601
|
readonly top_logprobs?: number | undefined;
|
|
313
|
-
readonly max_output_tokens?: number | undefined;
|
|
314
602
|
readonly max_tool_calls?: number | undefined;
|
|
315
603
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>)[];
|
|
316
604
|
export declare const configure: (input?: Config) => {
|
|
317
605
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
318
606
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
319
607
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
608
|
+
messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
320
609
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
321
610
|
configure: (input?: Config) => /*elided*/ any;
|
|
322
611
|
};
|
|
@@ -324,15 +613,18 @@ export declare const provider: {
|
|
|
324
613
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
325
614
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
326
615
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
616
|
+
messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
327
617
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
328
618
|
configure: (input?: Config) => {
|
|
329
619
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
330
620
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
331
621
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
622
|
+
messages: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
332
623
|
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
333
624
|
configure: /*elided*/ any;
|
|
334
625
|
};
|
|
335
626
|
};
|
|
336
627
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
628
|
+
export declare const messagesModel: ProviderPackage.Definition<MessagesSettings, AnthropicMessages.ProviderOptionsInput>["model"];
|
|
337
629
|
export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
338
|
-
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
630
|
+
export declare const model: (modelID: string, settings: Settings<import("./openai-options.js").OpenAIOptionsInput>) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Route } from "../route/client.js";
|
|
2
2
|
import { Endpoint } from "../route/endpoint.js";
|
|
3
|
+
import { AnthropicMessages } from "../protocols/anthropic-messages.js";
|
|
3
4
|
import { OpenAIChat } from "../protocols/openai-chat.js";
|
|
4
5
|
import { OpenResponses } from "../protocols/open-responses.js";
|
|
5
6
|
import { BedrockAuth } from "../protocols/utils/bedrock-auth.js";
|
|
7
|
+
import { claudeVersion } from "../protocols/utils/claude-model.js";
|
|
6
8
|
import { ProviderConfigurationError, ProviderID } from "../schema/index.js";
|
|
7
9
|
import { withOpenAIOptions } from "./openai-options.js";
|
|
8
10
|
export const id = ProviderID.make("amazon-bedrock");
|
|
@@ -20,11 +22,30 @@ const chatRoute = OpenAIChat.route.with({
|
|
|
20
22
|
provider: id,
|
|
21
23
|
providerMetadataKey: "mantle",
|
|
22
24
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const messagesRoute = Route.make({
|
|
26
|
+
id: "bedrock-mantle-messages",
|
|
27
|
+
provider: id,
|
|
28
|
+
providerMetadataKey: "mantle",
|
|
29
|
+
protocol: {
|
|
30
|
+
...AnthropicMessages.protocol,
|
|
31
|
+
// Mantle rejects mid-conversation `output_config` on Opus 5.0; support starts at 5.1+.
|
|
32
|
+
supportsEffortUpdates: (request) => {
|
|
33
|
+
const override = request.model.compatibility?.supportsEffortUpdates;
|
|
34
|
+
if (override !== undefined)
|
|
35
|
+
return override;
|
|
36
|
+
const version = claudeVersion(request.model.id);
|
|
37
|
+
return version !== undefined && (version.major > 5 || (version.major === 5 && version.minor >= 1));
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
endpoint: Endpoint.path(AnthropicMessages.PATH),
|
|
41
|
+
transport: AnthropicMessages.transport(),
|
|
42
|
+
headers: () => ({ "anthropic-version": "2023-06-01" }),
|
|
43
|
+
});
|
|
44
|
+
export const routes = [responsesRoute, chatRoute, messagesRoute];
|
|
45
|
+
const configuredRoute = (route, input, defaultBaseURL = (region) => `https://bedrock-mantle.${region}.api.aws/v1`) => {
|
|
25
46
|
const region = BedrockAuth.resolveRegion(input);
|
|
26
47
|
return route.with({
|
|
27
|
-
endpoint: { baseURL: input.baseURL ??
|
|
48
|
+
endpoint: { baseURL: input.baseURL ?? defaultBaseURL(region) },
|
|
28
49
|
auth: BedrockAuth.resolveAuth(input, region, {
|
|
29
50
|
service: "bedrock-mantle",
|
|
30
51
|
name: "Bedrock Mantle",
|
|
@@ -46,6 +67,7 @@ export const configure = (input = {}) => {
|
|
|
46
67
|
});
|
|
47
68
|
const configuredResponsesRoute = configuredRoute(responsesRoute, input);
|
|
48
69
|
const configuredChatRoute = configuredRoute(chatRoute, input);
|
|
70
|
+
const configuredMessagesRoute = configuredRoute(messagesRoute, input, (region) => `https://bedrock-mantle.${region}.api.aws/anthropic/v1`);
|
|
49
71
|
const modelDefaults = defaults(input);
|
|
50
72
|
const responses = (modelID) => configuredResponsesRoute
|
|
51
73
|
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
@@ -53,10 +75,12 @@ export const configure = (input = {}) => {
|
|
|
53
75
|
const chat = (modelID) => configuredChatRoute
|
|
54
76
|
.with(withOpenAIOptions(modelID, modelDefaults))
|
|
55
77
|
.model({ id: modelID });
|
|
78
|
+
const messages = (modelID) => configuredMessagesRoute.with(modelDefaults).model({ id: modelID });
|
|
56
79
|
return {
|
|
57
80
|
id,
|
|
58
81
|
model: responses,
|
|
59
82
|
chat,
|
|
83
|
+
messages,
|
|
60
84
|
responses,
|
|
61
85
|
configure,
|
|
62
86
|
};
|
|
@@ -75,5 +99,6 @@ const fromSettings = ({ apiKey, auth, baseURL, body, credentials, headers, profi
|
|
|
75
99
|
region,
|
|
76
100
|
});
|
|
77
101
|
export const chatModel = (modelID, settings) => fromSettings(settings).chat(modelID);
|
|
102
|
+
export const messagesModel = (modelID, settings) => fromSettings(settings).messages(modelID);
|
|
78
103
|
export const responsesModel = (modelID, settings) => fromSettings(settings).responses(modelID);
|
|
79
104
|
export const model = responsesModel;
|
|
@@ -64,6 +64,10 @@ declare const responsesRoute: Route<{
|
|
|
64
64
|
readonly reasoning: {
|
|
65
65
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
66
66
|
};
|
|
67
|
+
} | {
|
|
68
|
+
readonly [x: string]: unknown;
|
|
69
|
+
readonly type: string;
|
|
70
|
+
readonly id: string;
|
|
67
71
|
} | {
|
|
68
72
|
readonly type: "reasoning";
|
|
69
73
|
readonly summary: readonly {
|
|
@@ -140,34 +144,6 @@ declare const responsesRoute: Route<{
|
|
|
140
144
|
readonly type: "input_video";
|
|
141
145
|
readonly video_url: string;
|
|
142
146
|
})[];
|
|
143
|
-
} | {
|
|
144
|
-
readonly [x: string]: unknown;
|
|
145
|
-
readonly id: string;
|
|
146
|
-
readonly type: "computer_call";
|
|
147
|
-
readonly status?: string | undefined;
|
|
148
|
-
readonly action?: {
|
|
149
|
-
readonly [x: string]: unknown;
|
|
150
|
-
} | null | undefined;
|
|
151
|
-
readonly call_id?: string | undefined;
|
|
152
|
-
readonly pending_safety_checks?: readonly {
|
|
153
|
-
readonly [x: string]: unknown;
|
|
154
|
-
}[] | undefined;
|
|
155
|
-
} | {
|
|
156
|
-
readonly [x: string]: unknown;
|
|
157
|
-
readonly id: string;
|
|
158
|
-
readonly type: "web_search_preview_call";
|
|
159
|
-
readonly status?: string | undefined;
|
|
160
|
-
readonly action?: {
|
|
161
|
-
readonly [x: string]: unknown;
|
|
162
|
-
} | null | undefined;
|
|
163
|
-
} | {
|
|
164
|
-
readonly [x: string]: unknown;
|
|
165
|
-
readonly id: string;
|
|
166
|
-
readonly type: "image_generation_call";
|
|
167
|
-
readonly status?: string | undefined;
|
|
168
|
-
readonly result?: string | null | undefined;
|
|
169
|
-
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
170
|
-
readonly revised_prompt?: string | null | undefined;
|
|
171
147
|
})[];
|
|
172
148
|
readonly model: string;
|
|
173
149
|
readonly stream: true;
|
|
@@ -236,9 +212,10 @@ declare const responsesRoute: Route<{
|
|
|
236
212
|
readonly top_p?: number | undefined;
|
|
237
213
|
readonly frequency_penalty?: number | undefined;
|
|
238
214
|
readonly presence_penalty?: number | undefined;
|
|
215
|
+
readonly store?: boolean | undefined;
|
|
216
|
+
readonly max_output_tokens?: number | undefined;
|
|
239
217
|
readonly prompt_cache_key?: string | undefined;
|
|
240
218
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
241
|
-
readonly store?: boolean | undefined;
|
|
242
219
|
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
243
220
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
244
221
|
readonly stream_options?: {
|
|
@@ -246,7 +223,6 @@ declare const responsesRoute: Route<{
|
|
|
246
223
|
} | undefined;
|
|
247
224
|
readonly safety_identifier?: string | undefined;
|
|
248
225
|
readonly top_logprobs?: number | undefined;
|
|
249
|
-
readonly max_output_tokens?: number | undefined;
|
|
250
226
|
readonly max_tool_calls?: number | undefined;
|
|
251
227
|
}, import("../protocols/open-responses-channel.js").Prepared, {
|
|
252
228
|
endpoint: import("../route/client.js").CompactOperation;
|
|
@@ -365,9 +341,9 @@ export declare const routes: (Route<{
|
|
|
365
341
|
readonly top_p?: number | undefined;
|
|
366
342
|
readonly frequency_penalty?: number | undefined;
|
|
367
343
|
readonly presence_penalty?: number | undefined;
|
|
344
|
+
readonly store?: boolean | undefined;
|
|
368
345
|
readonly prompt_cache_key?: string | undefined;
|
|
369
346
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
370
|
-
readonly store?: boolean | undefined;
|
|
371
347
|
readonly stream_options?: {
|
|
372
348
|
readonly include_usage: boolean;
|
|
373
349
|
} | undefined;
|
|
@@ -415,6 +391,10 @@ export declare const routes: (Route<{
|
|
|
415
391
|
readonly reasoning: {
|
|
416
392
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
417
393
|
};
|
|
394
|
+
} | {
|
|
395
|
+
readonly [x: string]: unknown;
|
|
396
|
+
readonly type: string;
|
|
397
|
+
readonly id: string;
|
|
418
398
|
} | {
|
|
419
399
|
readonly type: "reasoning";
|
|
420
400
|
readonly summary: readonly {
|
|
@@ -491,34 +471,6 @@ export declare const routes: (Route<{
|
|
|
491
471
|
readonly type: "input_video";
|
|
492
472
|
readonly video_url: string;
|
|
493
473
|
})[];
|
|
494
|
-
} | {
|
|
495
|
-
readonly [x: string]: unknown;
|
|
496
|
-
readonly id: string;
|
|
497
|
-
readonly type: "computer_call";
|
|
498
|
-
readonly status?: string | undefined;
|
|
499
|
-
readonly action?: {
|
|
500
|
-
readonly [x: string]: unknown;
|
|
501
|
-
} | null | undefined;
|
|
502
|
-
readonly call_id?: string | undefined;
|
|
503
|
-
readonly pending_safety_checks?: readonly {
|
|
504
|
-
readonly [x: string]: unknown;
|
|
505
|
-
}[] | undefined;
|
|
506
|
-
} | {
|
|
507
|
-
readonly [x: string]: unknown;
|
|
508
|
-
readonly id: string;
|
|
509
|
-
readonly type: "web_search_preview_call";
|
|
510
|
-
readonly status?: string | undefined;
|
|
511
|
-
readonly action?: {
|
|
512
|
-
readonly [x: string]: unknown;
|
|
513
|
-
} | null | undefined;
|
|
514
|
-
} | {
|
|
515
|
-
readonly [x: string]: unknown;
|
|
516
|
-
readonly id: string;
|
|
517
|
-
readonly type: "image_generation_call";
|
|
518
|
-
readonly status?: string | undefined;
|
|
519
|
-
readonly result?: string | null | undefined;
|
|
520
|
-
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
521
|
-
readonly revised_prompt?: string | null | undefined;
|
|
522
474
|
})[];
|
|
523
475
|
readonly model: string;
|
|
524
476
|
readonly stream: true;
|
|
@@ -587,9 +539,10 @@ export declare const routes: (Route<{
|
|
|
587
539
|
readonly top_p?: number | undefined;
|
|
588
540
|
readonly frequency_penalty?: number | undefined;
|
|
589
541
|
readonly presence_penalty?: number | undefined;
|
|
542
|
+
readonly store?: boolean | undefined;
|
|
543
|
+
readonly max_output_tokens?: number | undefined;
|
|
590
544
|
readonly prompt_cache_key?: string | undefined;
|
|
591
545
|
readonly parallel_tool_calls?: boolean | undefined;
|
|
592
|
-
readonly store?: boolean | undefined;
|
|
593
546
|
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
594
547
|
readonly truncation?: "auto" | "disabled" | undefined;
|
|
595
548
|
readonly stream_options?: {
|
|
@@ -597,7 +550,6 @@ export declare const routes: (Route<{
|
|
|
597
550
|
} | undefined;
|
|
598
551
|
readonly safety_identifier?: string | undefined;
|
|
599
552
|
readonly top_logprobs?: number | undefined;
|
|
600
|
-
readonly max_output_tokens?: number | undefined;
|
|
601
553
|
readonly max_tool_calls?: number | undefined;
|
|
602
554
|
}, import("../protocols/open-responses-channel.js").Prepared, {
|
|
603
555
|
endpoint: import("../route/client.js").CompactOperation;
|
|
@@ -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;
|