@opencode/ai 0.0.0-dev-21920 → 0.0.0-dev-44
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 -19
- package/dist/ai-client.d.ts +2 -2
- package/dist/cache-policy.d.ts +4 -0
- package/dist/cache-policy.js +20 -6
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +4 -1
- package/dist/decision.js +3 -0
- package/dist/effect.d.ts +4 -5
- package/dist/effect.js +2 -3
- package/dist/experimental/realtime.d.ts +3 -2
- package/dist/image-client.d.ts +1 -1
- package/dist/image.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/llm.d.ts +3 -0
- package/dist/media-client.d.ts +2 -1
- package/dist/media-model.d.ts +3 -0
- package/dist/media-model.js +4 -1
- package/dist/protocols/alibaba-chat.d.ts +4 -0
- package/dist/protocols/alibaba-messages.d.ts +19 -19
- package/dist/protocols/alibaba-responses.d.ts +3 -3
- package/dist/protocols/anthropic-messages.d.ts +59 -59
- package/dist/protocols/anthropic-messages.js +3 -5
- package/dist/protocols/bedrock-converse.d.ts +110 -15
- package/dist/protocols/bedrock-converse.js +112 -15
- package/dist/protocols/bedrock-event-stream.js +1 -0
- package/dist/protocols/meta-messages.d.ts +19 -19
- package/dist/protocols/meta-messages.js +2 -1
- package/dist/protocols/open-responses.d.ts +3 -0
- package/dist/protocols/openai-chat.d.ts +588 -1
- package/dist/protocols/openai-chat.js +7 -2
- package/dist/protocols/openai-compatible-chat.d.ts +6 -2
- package/dist/protocols/openai-compatible-responses.d.ts +3 -3
- package/dist/protocols/openai-responses.d.ts +24 -0
- package/dist/protocols/openai-responses.js +5 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
- package/dist/protocols/utils/bedrock-cache.js +7 -6
- package/dist/protocols/utils/cache.d.ts +14 -3
- package/dist/protocols/utils/cache.js +11 -4
- package/dist/protocols/utils/gemini-json-schema.d.ts +5 -0
- package/dist/protocols/utils/gemini-json-schema.js +3 -3
- package/dist/protocols/utils/tool-schema.js +15 -5
- package/dist/protocols/utils/tool-stream.d.ts +9 -0
- package/dist/protocols/venice-chat.d.ts +3 -0
- package/dist/protocols/venice-chat.js +1 -1
- package/dist/protocols/zai-chat.d.ts +4 -0
- package/dist/protocols/zai-messages.d.ts +19 -19
- package/dist/providers/alibaba/images.d.ts +2 -0
- package/dist/providers/alibaba/images.js +1 -0
- package/dist/providers/alibaba.d.ts +26 -21
- package/dist/providers/alibaba.js +12 -8
- package/dist/providers/amazon-bedrock-mantle.d.ts +23 -19
- package/dist/providers/amazon-bedrock.d.ts +34 -14
- package/dist/providers/amazon-bedrock.js +11 -11
- package/dist/providers/anthropic-compatible.d.ts +19 -19
- package/dist/providers/anthropic.d.ts +19 -19
- package/dist/providers/azure/images.d.ts +2 -0
- package/dist/providers/azure/images.js +1 -0
- package/dist/providers/azure.d.ts +15 -1
- package/dist/providers/azure.js +19 -1
- package/dist/providers/baseten/decisions.d.ts +2 -0
- package/dist/providers/baseten/decisions.js +1 -0
- package/dist/providers/baseten.d.ts +13 -4
- package/dist/providers/baseten.js +15 -8
- package/dist/providers/cerebras.d.ts +8 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +57 -40
- package/dist/providers/cloudflare-ai-gateway.js +11 -6
- package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
- package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/images.js +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +13 -3
- package/dist/providers/cloudflare-workers-ai.js +16 -7
- package/dist/providers/cohere.d.ts +8 -0
- package/dist/providers/deepinfra.d.ts +8 -0
- package/dist/providers/deepseek.d.ts +8 -0
- package/dist/providers/digitalocean/decisions.d.ts +2 -0
- package/dist/providers/digitalocean/decisions.js +1 -0
- package/dist/providers/digitalocean/images.d.ts +2 -0
- package/dist/providers/digitalocean/images.js +1 -0
- package/dist/providers/digitalocean.d.ts +21 -4
- package/dist/providers/digitalocean.js +25 -8
- package/dist/providers/fireworks.d.ts +8 -0
- package/dist/providers/google/images.d.ts +2 -0
- package/dist/providers/google/images.js +1 -0
- package/dist/providers/google-vertex/images.d.ts +2 -0
- package/dist/providers/google-vertex/images.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +4 -0
- package/dist/providers/google-vertex-messages.d.ts +19 -19
- package/dist/providers/google-vertex.d.ts +3 -1
- package/dist/providers/google-vertex.js +30 -13
- package/dist/providers/google.d.ts +5 -4
- package/dist/providers/google.js +15 -8
- package/dist/providers/groq.d.ts +8 -0
- package/dist/providers/meta.d.ts +23 -19
- package/dist/providers/minimax.d.ts +23 -19
- package/dist/providers/moonshot.d.ts +23 -19
- package/dist/providers/openai/images.d.ts +2 -0
- package/dist/providers/openai/images.js +1 -0
- package/dist/providers/openai-compatible/images.d.ts +2 -0
- package/dist/providers/openai-compatible/images.js +1 -0
- package/dist/providers/openai-compatible.d.ts +7 -1
- package/dist/providers/openai-compatible.js +21 -9
- package/dist/providers/openai.d.ts +18 -8
- package/dist/providers/openai.js +10 -2
- package/dist/providers/opencode/decisions.d.ts +2 -0
- package/dist/providers/opencode/decisions.js +1 -0
- package/dist/providers/opencode.d.ts +9 -4
- package/dist/providers/opencode.js +2 -1
- package/dist/providers/openrouter/decisions.d.ts +2 -0
- package/dist/providers/openrouter/decisions.js +1 -0
- package/dist/providers/openrouter/images.d.ts +2 -0
- package/dist/providers/openrouter/images.js +1 -0
- package/dist/providers/openrouter.d.ts +25 -4
- package/dist/providers/openrouter.js +31 -9
- package/dist/providers/togetherai.d.ts +8 -0
- package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
- package/dist/providers/typesafe-ai/decisions.js +1 -0
- package/dist/providers/typesafe-ai.d.ts +9 -4
- package/dist/providers/typesafe-ai.js +2 -1
- package/dist/providers/venice.d.ts +3 -0
- package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
- package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/images.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +9 -7
- package/dist/providers/vercel-ai-gateway.js +18 -10
- package/dist/providers/xai/images.d.ts +2 -0
- package/dist/providers/xai/images.js +1 -0
- package/dist/providers/xai.d.ts +9 -4
- package/dist/providers/xai.js +15 -8
- package/dist/providers/zai/images.d.ts +2 -0
- package/dist/providers/zai/images.js +1 -0
- package/dist/providers/zai-coding-plan.d.ts +23 -19
- package/dist/providers/zai.d.ts +9 -4
- package/dist/providers/zai.js +15 -8
- package/dist/route/client.d.ts +2 -2
- package/dist/route/client.js +15 -4
- package/dist/route/decision.d.ts +2 -1
- package/dist/route/decision.js +1 -0
- package/dist/route/executor.d.ts +1 -1
- package/dist/route/framing.d.ts +2 -0
- package/dist/route/index.d.ts +3 -0
- package/dist/route/index.js +3 -0
- package/dist/route/media.d.ts +5 -1
- package/dist/route/media.js +6 -2
- package/dist/route/transport/http.js +1 -0
- package/dist/route/transport/index.d.ts +1 -0
- package/dist/schema/events.d.ts +135 -6
- package/dist/schema/events.js +10 -0
- package/dist/schema/messages.d.ts +6 -2
- package/dist/schema/messages.js +3 -0
- package/dist/schema/options.d.ts +5 -3
- package/dist/schema/options.js +8 -3
- package/dist/speech-client.d.ts +1 -1
- package/dist/speech.js +2 -1
- package/dist/testing.d.ts +25 -24
- package/dist/testing.js +3 -21
- package/dist/transcription-client.d.ts +1 -1
- package/dist/transcription.js +1 -0
- package/dist/video-client.d.ts +1 -1
- package/dist/video.js +1 -0
- package/package.json +510 -8
- package/dist/provider.d.ts +0 -23
- package/dist/provider.js +0 -2
|
@@ -4,7 +4,7 @@ import { AlibabaMessages } from "../protocols/alibaba-messages.js";
|
|
|
4
4
|
import { AlibabaResponses } from "../protocols/alibaba-responses.js";
|
|
5
5
|
import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js";
|
|
6
6
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
7
|
-
import { ToolDefinition, type ModelID } from "../schema/index.js";
|
|
7
|
+
import { ToolDefinition, type ModelID, type ProviderOptions } from "../schema/index.js";
|
|
8
8
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
9
9
|
export type Region = "ap-southeast-1" | "cn-beijing" | "cn-hongkong" | "us-east-1" | "eu-central-1" | "ap-northeast-1" | (string & {});
|
|
10
10
|
export type ChatOptionsInput = AlibabaChat.OptionsInput;
|
|
@@ -145,6 +145,10 @@ export declare const routes: (Route<{
|
|
|
145
145
|
} | undefined;
|
|
146
146
|
readonly store?: boolean | undefined;
|
|
147
147
|
readonly prompt_cache_key?: string | undefined;
|
|
148
|
+
readonly prompt_cache_retention?: string | undefined;
|
|
149
|
+
readonly prompt_cache_options?: {
|
|
150
|
+
readonly ttl?: string | undefined;
|
|
151
|
+
} | undefined;
|
|
148
152
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
149
153
|
readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
|
|
150
154
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
|
|
@@ -201,7 +205,7 @@ export declare const routes: (Route<{
|
|
|
201
205
|
readonly text: string;
|
|
202
206
|
readonly cache_control?: {
|
|
203
207
|
readonly type: "ephemeral";
|
|
204
|
-
readonly ttl?:
|
|
208
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
205
209
|
} | undefined;
|
|
206
210
|
}[] | undefined;
|
|
207
211
|
readonly messages: readonly ({
|
|
@@ -211,7 +215,7 @@ export declare const routes: (Route<{
|
|
|
211
215
|
readonly text: string;
|
|
212
216
|
readonly cache_control?: {
|
|
213
217
|
readonly type: "ephemeral";
|
|
214
|
-
readonly ttl?:
|
|
218
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
215
219
|
} | undefined;
|
|
216
220
|
} | {
|
|
217
221
|
readonly type: "image";
|
|
@@ -228,7 +232,7 @@ export declare const routes: (Route<{
|
|
|
228
232
|
};
|
|
229
233
|
readonly cache_control?: {
|
|
230
234
|
readonly type: "ephemeral";
|
|
231
|
-
readonly ttl?:
|
|
235
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
232
236
|
} | undefined;
|
|
233
237
|
readonly transformations?: {
|
|
234
238
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
@@ -248,7 +252,7 @@ export declare const routes: (Route<{
|
|
|
248
252
|
};
|
|
249
253
|
readonly cache_control?: {
|
|
250
254
|
readonly type: "ephemeral";
|
|
251
|
-
readonly ttl?:
|
|
255
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
252
256
|
} | undefined;
|
|
253
257
|
} | {
|
|
254
258
|
readonly type: "document";
|
|
@@ -269,7 +273,7 @@ export declare const routes: (Route<{
|
|
|
269
273
|
};
|
|
270
274
|
readonly cache_control?: {
|
|
271
275
|
readonly type: "ephemeral";
|
|
272
|
-
readonly ttl?:
|
|
276
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
273
277
|
} | undefined;
|
|
274
278
|
readonly title?: string | undefined;
|
|
275
279
|
readonly context?: string | undefined;
|
|
@@ -284,7 +288,7 @@ export declare const routes: (Route<{
|
|
|
284
288
|
readonly text: string;
|
|
285
289
|
readonly cache_control?: {
|
|
286
290
|
readonly type: "ephemeral";
|
|
287
|
-
readonly ttl?:
|
|
291
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
288
292
|
} | undefined;
|
|
289
293
|
} | {
|
|
290
294
|
readonly type: "image";
|
|
@@ -301,7 +305,7 @@ export declare const routes: (Route<{
|
|
|
301
305
|
};
|
|
302
306
|
readonly cache_control?: {
|
|
303
307
|
readonly type: "ephemeral";
|
|
304
|
-
readonly ttl?:
|
|
308
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
305
309
|
} | undefined;
|
|
306
310
|
readonly transformations?: {
|
|
307
311
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
@@ -321,7 +325,7 @@ export declare const routes: (Route<{
|
|
|
321
325
|
};
|
|
322
326
|
readonly cache_control?: {
|
|
323
327
|
readonly type: "ephemeral";
|
|
324
|
-
readonly ttl?:
|
|
328
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
325
329
|
} | undefined;
|
|
326
330
|
} | {
|
|
327
331
|
readonly type: "document";
|
|
@@ -342,7 +346,7 @@ export declare const routes: (Route<{
|
|
|
342
346
|
};
|
|
343
347
|
readonly cache_control?: {
|
|
344
348
|
readonly type: "ephemeral";
|
|
345
|
-
readonly ttl?:
|
|
349
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
346
350
|
} | undefined;
|
|
347
351
|
readonly title?: string | undefined;
|
|
348
352
|
readonly context?: string | undefined;
|
|
@@ -353,7 +357,7 @@ export declare const routes: (Route<{
|
|
|
353
357
|
readonly is_error?: boolean | undefined;
|
|
354
358
|
readonly cache_control?: {
|
|
355
359
|
readonly type: "ephemeral";
|
|
356
|
-
readonly ttl?:
|
|
360
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
357
361
|
} | undefined;
|
|
358
362
|
})[];
|
|
359
363
|
} | {
|
|
@@ -366,7 +370,7 @@ export declare const routes: (Route<{
|
|
|
366
370
|
readonly text: string;
|
|
367
371
|
readonly cache_control?: {
|
|
368
372
|
readonly type: "ephemeral";
|
|
369
|
-
readonly ttl?:
|
|
373
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
370
374
|
} | undefined;
|
|
371
375
|
} | {
|
|
372
376
|
readonly type: "thinking";
|
|
@@ -374,14 +378,14 @@ export declare const routes: (Route<{
|
|
|
374
378
|
readonly signature: string;
|
|
375
379
|
readonly cache_control?: {
|
|
376
380
|
readonly type: "ephemeral";
|
|
377
|
-
readonly ttl?:
|
|
381
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
378
382
|
} | undefined;
|
|
379
383
|
} | {
|
|
380
384
|
readonly type: "redacted_thinking";
|
|
381
385
|
readonly data: string;
|
|
382
386
|
readonly cache_control?: {
|
|
383
387
|
readonly type: "ephemeral";
|
|
384
|
-
readonly ttl?:
|
|
388
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
385
389
|
} | undefined;
|
|
386
390
|
} | {
|
|
387
391
|
readonly type: "tool_use";
|
|
@@ -390,7 +394,7 @@ export declare const routes: (Route<{
|
|
|
390
394
|
readonly input: unknown;
|
|
391
395
|
readonly cache_control?: {
|
|
392
396
|
readonly type: "ephemeral";
|
|
393
|
-
readonly ttl?:
|
|
397
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
394
398
|
} | undefined;
|
|
395
399
|
} | {
|
|
396
400
|
readonly type: "server_tool_use";
|
|
@@ -399,7 +403,7 @@ export declare const routes: (Route<{
|
|
|
399
403
|
readonly input: unknown;
|
|
400
404
|
readonly cache_control?: {
|
|
401
405
|
readonly type: "ephemeral";
|
|
402
|
-
readonly ttl?:
|
|
406
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
403
407
|
} | undefined;
|
|
404
408
|
} | {
|
|
405
409
|
readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
|
|
@@ -407,7 +411,7 @@ export declare const routes: (Route<{
|
|
|
407
411
|
readonly content: unknown;
|
|
408
412
|
readonly cache_control?: {
|
|
409
413
|
readonly type: "ephemeral";
|
|
410
|
-
readonly ttl?:
|
|
414
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
411
415
|
} | undefined;
|
|
412
416
|
})[];
|
|
413
417
|
} | {
|
|
@@ -417,7 +421,7 @@ export declare const routes: (Route<{
|
|
|
417
421
|
readonly text: string;
|
|
418
422
|
readonly cache_control?: {
|
|
419
423
|
readonly type: "ephemeral";
|
|
420
|
-
readonly ttl?:
|
|
424
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
421
425
|
} | undefined;
|
|
422
426
|
}[];
|
|
423
427
|
readonly output_config?: {
|
|
@@ -432,7 +436,7 @@ export declare const routes: (Route<{
|
|
|
432
436
|
};
|
|
433
437
|
readonly cache_control?: {
|
|
434
438
|
readonly type: "ephemeral";
|
|
435
|
-
readonly ttl?:
|
|
439
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
436
440
|
} | undefined;
|
|
437
441
|
}[] | undefined;
|
|
438
442
|
readonly tool_choice?: {
|
|
@@ -460,7 +464,7 @@ export declare const routes: (Route<{
|
|
|
460
464
|
} | undefined;
|
|
461
465
|
readonly cache_control?: {
|
|
462
466
|
readonly type: "ephemeral";
|
|
463
|
-
readonly ttl?:
|
|
467
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
464
468
|
} | undefined;
|
|
465
469
|
readonly container?: string | {
|
|
466
470
|
readonly id?: string | null | undefined;
|
|
@@ -722,7 +726,7 @@ export declare const configure: (input: Config) => {
|
|
|
722
726
|
readonly previousResponseId?: string | undefined;
|
|
723
727
|
readonly conversation?: string | undefined;
|
|
724
728
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
725
|
-
image: (id: string | ModelID) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
|
|
729
|
+
image: (id: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
|
|
726
730
|
configure: typeof configure;
|
|
727
731
|
};
|
|
728
732
|
export declare const provider: {
|
|
@@ -732,6 +736,7 @@ export declare const provider: {
|
|
|
732
736
|
export declare const model: ProviderPackage.Definition<Settings, ChatOptionsInput>["model"];
|
|
733
737
|
export declare const messagesModel: ProviderPackage.Definition<Settings<MessagesOptionsInput>, MessagesOptionsInput>["model"];
|
|
734
738
|
export declare const responsesModel: ProviderPackage.Definition<Settings<ResponsesOptionsInput>, ResponsesOptionsInput>["model"];
|
|
739
|
+
export declare const imageModel: (id: string, settings: Settings) => import("../image.js").ImageModel<import("./alibaba.js").AlibabaImageOptions>;
|
|
735
740
|
export declare const webSearch: () => ToolDefinition;
|
|
736
741
|
export declare const webExtractor: () => ToolDefinition;
|
|
737
742
|
export declare const codeInterpreter: () => ToolDefinition;
|
|
@@ -8,7 +8,7 @@ import { Route } from "../route/client.js";
|
|
|
8
8
|
import { Endpoint } from "../route/endpoint.js";
|
|
9
9
|
import { Framing } from "../route/framing.js";
|
|
10
10
|
import { MediaRoute } from "../route/media.js";
|
|
11
|
-
import { ProviderConfigurationError, ProviderID, ToolDefinition } from "../schema/index.js";
|
|
11
|
+
import { ProviderConfigurationError, ProviderID, ToolDefinition, } from "../schema/index.js";
|
|
12
12
|
export const id = ProviderID.make("alibaba");
|
|
13
13
|
const hosts = new Map([
|
|
14
14
|
["ap-southeast-1", "dashscope-intl.aliyuncs.com"],
|
|
@@ -69,20 +69,24 @@ export const configure = (input) => {
|
|
|
69
69
|
.model({ id, compatibility: { requireSignature: false } });
|
|
70
70
|
const responses = (id) => responsesRoute.with(common).model({ id });
|
|
71
71
|
const media = MediaRoute.deployment({ ...input, baseURL: baseURL ?? `https://${host}/api/v1` }, opts.auth);
|
|
72
|
-
const image = (id) => AlibabaImages.model({ ...media, id });
|
|
72
|
+
const image = (id, providerOptions) => AlibabaImages.model({ ...media, id, providerOptions });
|
|
73
73
|
return { id, model: chat, chat, messages, responses, image, configure };
|
|
74
74
|
};
|
|
75
75
|
export const provider = { id, configure };
|
|
76
|
-
export const model = (id, input) =>
|
|
77
|
-
export const messagesModel = (id, input) =>
|
|
78
|
-
export const responsesModel = (id, input) =>
|
|
79
|
-
|
|
76
|
+
export const model = (id, input) => configure(config(input)).chat(id);
|
|
77
|
+
export const messagesModel = (id, input) => configure(config(input)).messages(id);
|
|
78
|
+
export const responsesModel = (id, input) => configure(config(input)).responses(id);
|
|
79
|
+
export const imageModel = (id, settings) => {
|
|
80
|
+
const input = config(settings);
|
|
81
|
+
return configure(input).image(id, input.providerOptions);
|
|
82
|
+
};
|
|
83
|
+
function config(input) {
|
|
80
84
|
const { body, ...rest } = input;
|
|
81
|
-
return
|
|
85
|
+
return {
|
|
82
86
|
...rest,
|
|
83
87
|
http: body === undefined ? undefined : { body },
|
|
84
88
|
providerOptions: Struct.omit(rest, ["apiKey", "baseURL", "headers", "region", "workspaceID"]),
|
|
85
|
-
}
|
|
89
|
+
};
|
|
86
90
|
}
|
|
87
91
|
export const webSearch = () => hostedTool("web_search", "Search the web with Alibaba's hosted search tool.");
|
|
88
92
|
export const webExtractor = () => hostedTool("web_extractor", "Extract web page content with Alibaba's hosted tool.");
|
|
@@ -48,7 +48,7 @@ export declare const routes: (Route<{
|
|
|
48
48
|
readonly text: string;
|
|
49
49
|
readonly cache_control?: {
|
|
50
50
|
readonly type: "ephemeral";
|
|
51
|
-
readonly ttl?:
|
|
51
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
52
52
|
} | undefined;
|
|
53
53
|
}[] | undefined;
|
|
54
54
|
readonly messages: readonly ({
|
|
@@ -58,7 +58,7 @@ export declare const routes: (Route<{
|
|
|
58
58
|
readonly text: string;
|
|
59
59
|
readonly cache_control?: {
|
|
60
60
|
readonly type: "ephemeral";
|
|
61
|
-
readonly ttl?:
|
|
61
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
62
62
|
} | undefined;
|
|
63
63
|
} | {
|
|
64
64
|
readonly type: "image";
|
|
@@ -75,7 +75,7 @@ export declare const routes: (Route<{
|
|
|
75
75
|
};
|
|
76
76
|
readonly cache_control?: {
|
|
77
77
|
readonly type: "ephemeral";
|
|
78
|
-
readonly ttl?:
|
|
78
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
79
79
|
} | undefined;
|
|
80
80
|
readonly transformations?: {
|
|
81
81
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
@@ -95,7 +95,7 @@ export declare const routes: (Route<{
|
|
|
95
95
|
};
|
|
96
96
|
readonly cache_control?: {
|
|
97
97
|
readonly type: "ephemeral";
|
|
98
|
-
readonly ttl?:
|
|
98
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
99
99
|
} | undefined;
|
|
100
100
|
} | {
|
|
101
101
|
readonly type: "document";
|
|
@@ -116,7 +116,7 @@ export declare const routes: (Route<{
|
|
|
116
116
|
};
|
|
117
117
|
readonly cache_control?: {
|
|
118
118
|
readonly type: "ephemeral";
|
|
119
|
-
readonly ttl?:
|
|
119
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
120
120
|
} | undefined;
|
|
121
121
|
readonly title?: string | undefined;
|
|
122
122
|
readonly context?: string | undefined;
|
|
@@ -131,7 +131,7 @@ export declare const routes: (Route<{
|
|
|
131
131
|
readonly text: string;
|
|
132
132
|
readonly cache_control?: {
|
|
133
133
|
readonly type: "ephemeral";
|
|
134
|
-
readonly ttl?:
|
|
134
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
135
135
|
} | undefined;
|
|
136
136
|
} | {
|
|
137
137
|
readonly type: "image";
|
|
@@ -148,7 +148,7 @@ export declare const routes: (Route<{
|
|
|
148
148
|
};
|
|
149
149
|
readonly cache_control?: {
|
|
150
150
|
readonly type: "ephemeral";
|
|
151
|
-
readonly ttl?:
|
|
151
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
152
152
|
} | undefined;
|
|
153
153
|
readonly transformations?: {
|
|
154
154
|
readonly oversized_image?: "downsize" | "error" | undefined;
|
|
@@ -168,7 +168,7 @@ export declare const routes: (Route<{
|
|
|
168
168
|
};
|
|
169
169
|
readonly cache_control?: {
|
|
170
170
|
readonly type: "ephemeral";
|
|
171
|
-
readonly ttl?:
|
|
171
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
172
172
|
} | undefined;
|
|
173
173
|
} | {
|
|
174
174
|
readonly type: "document";
|
|
@@ -189,7 +189,7 @@ export declare const routes: (Route<{
|
|
|
189
189
|
};
|
|
190
190
|
readonly cache_control?: {
|
|
191
191
|
readonly type: "ephemeral";
|
|
192
|
-
readonly ttl?:
|
|
192
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
193
193
|
} | undefined;
|
|
194
194
|
readonly title?: string | undefined;
|
|
195
195
|
readonly context?: string | undefined;
|
|
@@ -200,7 +200,7 @@ export declare const routes: (Route<{
|
|
|
200
200
|
readonly is_error?: boolean | undefined;
|
|
201
201
|
readonly cache_control?: {
|
|
202
202
|
readonly type: "ephemeral";
|
|
203
|
-
readonly ttl?:
|
|
203
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
204
204
|
} | undefined;
|
|
205
205
|
})[];
|
|
206
206
|
} | {
|
|
@@ -213,7 +213,7 @@ export declare const routes: (Route<{
|
|
|
213
213
|
readonly text: string;
|
|
214
214
|
readonly cache_control?: {
|
|
215
215
|
readonly type: "ephemeral";
|
|
216
|
-
readonly ttl?:
|
|
216
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
217
217
|
} | undefined;
|
|
218
218
|
} | {
|
|
219
219
|
readonly type: "thinking";
|
|
@@ -221,14 +221,14 @@ export declare const routes: (Route<{
|
|
|
221
221
|
readonly signature: string;
|
|
222
222
|
readonly cache_control?: {
|
|
223
223
|
readonly type: "ephemeral";
|
|
224
|
-
readonly ttl?:
|
|
224
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
225
225
|
} | undefined;
|
|
226
226
|
} | {
|
|
227
227
|
readonly type: "redacted_thinking";
|
|
228
228
|
readonly data: string;
|
|
229
229
|
readonly cache_control?: {
|
|
230
230
|
readonly type: "ephemeral";
|
|
231
|
-
readonly ttl?:
|
|
231
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
232
232
|
} | undefined;
|
|
233
233
|
} | {
|
|
234
234
|
readonly type: "tool_use";
|
|
@@ -237,7 +237,7 @@ export declare const routes: (Route<{
|
|
|
237
237
|
readonly input: unknown;
|
|
238
238
|
readonly cache_control?: {
|
|
239
239
|
readonly type: "ephemeral";
|
|
240
|
-
readonly ttl?:
|
|
240
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
241
241
|
} | undefined;
|
|
242
242
|
} | {
|
|
243
243
|
readonly type: "server_tool_use";
|
|
@@ -246,7 +246,7 @@ export declare const routes: (Route<{
|
|
|
246
246
|
readonly input: unknown;
|
|
247
247
|
readonly cache_control?: {
|
|
248
248
|
readonly type: "ephemeral";
|
|
249
|
-
readonly ttl?:
|
|
249
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
250
250
|
} | undefined;
|
|
251
251
|
} | {
|
|
252
252
|
readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
|
|
@@ -254,7 +254,7 @@ export declare const routes: (Route<{
|
|
|
254
254
|
readonly content: unknown;
|
|
255
255
|
readonly cache_control?: {
|
|
256
256
|
readonly type: "ephemeral";
|
|
257
|
-
readonly ttl?:
|
|
257
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
258
258
|
} | undefined;
|
|
259
259
|
})[];
|
|
260
260
|
} | {
|
|
@@ -264,7 +264,7 @@ export declare const routes: (Route<{
|
|
|
264
264
|
readonly text: string;
|
|
265
265
|
readonly cache_control?: {
|
|
266
266
|
readonly type: "ephemeral";
|
|
267
|
-
readonly ttl?:
|
|
267
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
268
268
|
} | undefined;
|
|
269
269
|
}[];
|
|
270
270
|
readonly output_config?: {
|
|
@@ -279,7 +279,7 @@ export declare const routes: (Route<{
|
|
|
279
279
|
};
|
|
280
280
|
readonly cache_control?: {
|
|
281
281
|
readonly type: "ephemeral";
|
|
282
|
-
readonly ttl?:
|
|
282
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
283
283
|
} | undefined;
|
|
284
284
|
}[] | undefined;
|
|
285
285
|
readonly tool_choice?: {
|
|
@@ -323,7 +323,7 @@ export declare const routes: (Route<{
|
|
|
323
323
|
} | undefined;
|
|
324
324
|
readonly cache_control?: {
|
|
325
325
|
readonly type: "ephemeral";
|
|
326
|
-
readonly ttl?:
|
|
326
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
327
327
|
} | undefined;
|
|
328
328
|
readonly container?: string | {
|
|
329
329
|
readonly id?: string | null | undefined;
|
|
@@ -638,6 +638,10 @@ export declare const routes: (Route<{
|
|
|
638
638
|
} | undefined;
|
|
639
639
|
readonly store?: boolean | undefined;
|
|
640
640
|
readonly prompt_cache_key?: string | undefined;
|
|
641
|
+
readonly prompt_cache_retention?: string | undefined;
|
|
642
|
+
readonly prompt_cache_options?: {
|
|
643
|
+
readonly ttl?: string | undefined;
|
|
644
|
+
} | undefined;
|
|
641
645
|
readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
|
|
642
646
|
readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
|
|
643
647
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
|
|
@@ -18,8 +18,9 @@ export type Config = RouteDefaultsInput & {
|
|
|
18
18
|
readonly region?: string;
|
|
19
19
|
/** Override the computed `https://bedrock-runtime.<region>.amazonaws.com` URL. */
|
|
20
20
|
readonly baseURL?: string;
|
|
21
|
+
readonly providerOptions?: BedrockConverse.OptionsInput;
|
|
21
22
|
};
|
|
22
|
-
export
|
|
23
|
+
export type Settings = ProviderPackage.Settings & BedrockConverse.OptionsInput & {
|
|
23
24
|
readonly apiKey?: string;
|
|
24
25
|
readonly auth?: "bearer" | "sigv4";
|
|
25
26
|
readonly baseURL?: string;
|
|
@@ -27,8 +28,7 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
27
28
|
readonly profile?: string;
|
|
28
29
|
readonly region?: string;
|
|
29
30
|
readonly topP?: number;
|
|
30
|
-
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
export declare const routes: import("../route/client.js").Route<{
|
|
33
33
|
readonly modelId: string;
|
|
34
34
|
readonly messages: readonly ({
|
|
@@ -36,7 +36,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
36
36
|
readonly content: readonly ({
|
|
37
37
|
readonly cachePoint: {
|
|
38
38
|
readonly type: "default";
|
|
39
|
-
readonly ttl?:
|
|
39
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
40
40
|
};
|
|
41
41
|
} | {
|
|
42
42
|
readonly image: {
|
|
@@ -86,7 +86,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
86
86
|
readonly content: readonly ({
|
|
87
87
|
readonly cachePoint: {
|
|
88
88
|
readonly type: "default";
|
|
89
|
-
readonly ttl?:
|
|
89
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
90
90
|
};
|
|
91
91
|
} | {
|
|
92
92
|
readonly text: string;
|
|
@@ -110,7 +110,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
110
110
|
readonly system?: readonly ({
|
|
111
111
|
readonly cachePoint: {
|
|
112
112
|
readonly type: "default";
|
|
113
|
-
readonly ttl?:
|
|
113
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
114
114
|
};
|
|
115
115
|
} | {
|
|
116
116
|
readonly text: string;
|
|
@@ -125,7 +125,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
125
125
|
readonly tools: readonly ({
|
|
126
126
|
readonly cachePoint: {
|
|
127
127
|
readonly type: "default";
|
|
128
|
-
readonly ttl?:
|
|
128
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
129
129
|
};
|
|
130
130
|
} | {
|
|
131
131
|
readonly toolSpec: {
|
|
@@ -151,22 +151,42 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
151
151
|
readonly additionalModelRequestFields?: {
|
|
152
152
|
readonly [x: string]: unknown;
|
|
153
153
|
} | undefined;
|
|
154
|
+
readonly serviceTier?: {
|
|
155
|
+
readonly type: import("../schema/options.js").OpenString<"default" | "flex" | "priority" | "reserved">;
|
|
156
|
+
} | undefined;
|
|
157
|
+
readonly guardrailConfig?: {
|
|
158
|
+
readonly guardrailIdentifier: string;
|
|
159
|
+
readonly guardrailVersion: string;
|
|
160
|
+
readonly trace?: import("../schema/options.js").OpenString<"disabled" | "enabled" | "enabled_full"> | undefined;
|
|
161
|
+
readonly streamProcessingMode?: import("../schema/options.js").OpenString<"async" | "sync"> | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
readonly outputConfig?: {
|
|
164
|
+
readonly textFormat: {
|
|
165
|
+
readonly type: import("../schema/options.js").OpenString<"json_schema">;
|
|
166
|
+
readonly structure: {
|
|
167
|
+
readonly jsonSchema: {
|
|
168
|
+
readonly schema: string;
|
|
169
|
+
readonly name?: string | undefined;
|
|
170
|
+
readonly description?: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
} | undefined;
|
|
175
|
+
readonly requestMetadata?: {
|
|
176
|
+
readonly [x: string]: string;
|
|
177
|
+
} | undefined;
|
|
154
178
|
}, import("../route/transport/http.js").HttpPrepared<{
|
|
155
179
|
readonly [x: string]: unknown;
|
|
156
180
|
readonly rawBody: string;
|
|
157
181
|
}>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
158
182
|
export declare const configure: (input?: Config) => {
|
|
159
183
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
160
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
161
|
-
readonly [x: string]: unknown;
|
|
162
|
-
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
184
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
163
185
|
configure: typeof configure;
|
|
164
186
|
};
|
|
165
187
|
export declare const provider: {
|
|
166
188
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
167
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
168
|
-
readonly [x: string]: unknown;
|
|
169
|
-
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
189
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<BedrockConverse.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
170
190
|
configure: typeof configure;
|
|
171
191
|
};
|
|
172
|
-
export declare const model: ProviderPackage.Definition<Settings>["model"];
|
|
192
|
+
export declare const model: ProviderPackage.Definition<Settings, BedrockConverse.OptionsInput>["model"];
|
|
@@ -28,15 +28,15 @@ export const configure = (input = {}) => {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export const provider = configure();
|
|
31
|
-
export const model = (modelID,
|
|
32
|
-
apiKey
|
|
33
|
-
auth
|
|
34
|
-
baseURL
|
|
35
|
-
credentials
|
|
36
|
-
generation:
|
|
37
|
-
headers:
|
|
38
|
-
http:
|
|
39
|
-
providerOptions
|
|
40
|
-
profile
|
|
41
|
-
region
|
|
31
|
+
export const model = (modelID, { apiKey, auth, baseURL, credentials, profile, region, topP, headers, body, ...providerOptions }) => configure({
|
|
32
|
+
apiKey,
|
|
33
|
+
auth,
|
|
34
|
+
baseURL,
|
|
35
|
+
credentials,
|
|
36
|
+
generation: topP === undefined ? undefined : { topP },
|
|
37
|
+
headers: headers === undefined ? undefined : { ...headers },
|
|
38
|
+
http: body === undefined ? undefined : { body: { ...body } },
|
|
39
|
+
providerOptions,
|
|
40
|
+
profile,
|
|
41
|
+
region,
|
|
42
42
|
}).model(modelID);
|