@opencode/ai 2.3.0 → 2.3.1
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 +65 -18
- package/dist/cache-policy.js +4 -2
- package/dist/effect.d.ts +3 -1
- package/dist/generation.d.ts +10 -10
- package/dist/generation.js +8 -14
- package/dist/image-client.d.ts +56 -59
- package/dist/image-client.js +47 -8
- package/dist/image.d.ts +36 -95
- package/dist/image.js +11 -14
- package/dist/index.d.ts +25 -25
- package/dist/index.js +29 -22
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +10 -1
- package/dist/media-client.d.ts +18 -6
- package/dist/media-client.js +42 -37
- package/dist/media.d.ts +17 -1
- package/dist/media.js +28 -7
- package/dist/protocols/alibaba-messages.d.ts +24 -2
- package/dist/protocols/alibaba-responses.d.ts +26 -0
- package/dist/protocols/anthropic-messages.d.ts +70 -6
- package/dist/protocols/anthropic-messages.js +74 -9
- package/dist/protocols/assemblyai-transcription.js +7 -6
- package/dist/protocols/cartesia-speech.d.ts +0 -8
- package/dist/protocols/deepgram-speech.d.ts +0 -8
- package/dist/protocols/elevenlabs-speech.d.ts +0 -8
- package/dist/protocols/google-interactions-video.d.ts +4 -9
- package/dist/protocols/google-interactions-video.js +9 -10
- package/dist/protocols/google-speech.d.ts +0 -8
- package/dist/protocols/google-transcription.d.ts +0 -8
- package/dist/protocols/meta-messages.d.ts +24 -2
- package/dist/protocols/meta-responses.d.ts +52 -0
- package/dist/protocols/minimax-video.d.ts +6 -15
- package/dist/protocols/minimax-video.js +25 -27
- package/dist/protocols/open-responses.d.ts +250 -24
- package/dist/protocols/open-responses.js +40 -24
- package/dist/protocols/openai-chat.js +7 -3
- package/dist/protocols/openai-compatible-responses.d.ts +26 -0
- package/dist/protocols/openai-freeform.d.ts +1 -1
- package/dist/protocols/openai-freeform.js +9 -5
- package/dist/protocols/openai-images.d.ts +0 -8
- package/dist/protocols/openai-responses.d.ts +153 -0
- package/dist/protocols/openai-responses.js +68 -7
- package/dist/protocols/openai-speech.d.ts +0 -8
- package/dist/protocols/openai-transcription.d.ts +0 -8
- package/dist/protocols/openrouter-video.d.ts +4 -9
- package/dist/protocols/openrouter-video.js +14 -13
- package/dist/protocols/seedance-video.d.ts +4 -9
- package/dist/protocols/seedance-video.js +13 -12
- package/dist/protocols/utils/gateway-protocol.js +1 -0
- package/dist/protocols/utils/responses-compaction.js +7 -3
- package/dist/protocols/xai-responses.d.ts +26 -0
- package/dist/protocols/xai-video.d.ts +4 -9
- package/dist/protocols/xai-video.js +13 -9
- package/dist/protocols/zai-messages.d.ts +24 -2
- package/dist/providers/alibaba.d.ts +50 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +50 -2
- package/dist/providers/anthropic-compatible.d.ts +24 -2
- package/dist/providers/anthropic.d.ts +24 -2
- package/dist/providers/azure.d.ts +76 -2
- package/dist/providers/cloudflare-ai-gateway.d.ts +100 -4
- package/dist/providers/digitalocean.d.ts +26 -0
- package/dist/providers/google-vertex-messages.d.ts +24 -2
- package/dist/providers/google-vertex-messages.js +1 -0
- package/dist/providers/google-vertex-responses.d.ts +26 -0
- package/dist/providers/google.d.ts +3 -3
- package/dist/providers/google.js +5 -2
- package/dist/providers/meta.d.ts +50 -2
- package/dist/providers/minimax.d.ts +50 -2
- package/dist/providers/moonshot.d.ts +50 -2
- package/dist/providers/openai-compatible-responses.d.ts +26 -0
- package/dist/providers/openai.d.ts +26 -0
- package/dist/providers/openrouter.d.ts +26 -0
- package/dist/providers/venice.d.ts +26 -0
- package/dist/providers/xai/videos.d.ts +2 -0
- package/dist/providers/xai/videos.js +1 -0
- package/dist/providers/xai.d.ts +4 -3
- package/dist/providers/xai.js +5 -1
- package/dist/providers/zai-coding-plan.d.ts +50 -2
- package/dist/public.d.ts +5 -4
- package/dist/public.js +1 -1
- package/dist/route/client.d.ts +2 -0
- package/dist/route/client.js +5 -1
- package/dist/route/executor-service.d.ts +14 -1
- package/dist/route/executor-service.js +28 -1
- package/dist/route/executor.d.ts +5 -2
- package/dist/route/executor.js +20 -5
- package/dist/route/media-protocol.d.ts +12 -7
- package/dist/route/media-protocol.js +11 -4
- package/dist/route/media.js +12 -3
- package/dist/route/protocol.d.ts +3 -0
- package/dist/schema/events.d.ts +5 -0
- package/dist/schema/messages.d.ts +24 -1
- package/dist/schema/messages.js +26 -2
- package/dist/schema/options.d.ts +10 -2
- package/dist/speech-client.d.ts +5 -5
- package/dist/speech.d.ts +7 -88
- package/dist/speech.js +1 -3
- package/dist/tool-updates.d.ts +34 -0
- package/dist/tool-updates.js +93 -0
- package/dist/tool.d.ts +6 -1
- package/dist/tool.js +1 -1
- package/dist/transcription-client.d.ts +5 -5
- package/dist/transcription.d.ts +7 -88
- package/dist/transcription.js +1 -3
- package/dist/video-client.d.ts +6 -6
- package/dist/video-client.js +13 -11
- package/dist/video.d.ts +17 -73
- package/dist/video.js +9 -8
- package/package.json +7 -3
|
@@ -24,6 +24,32 @@ export declare const routes: Route<{
|
|
|
24
24
|
readonly reasoning: {
|
|
25
25
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
26
26
|
};
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "additional_tools";
|
|
29
|
+
readonly role: "developer";
|
|
30
|
+
readonly tools: readonly ({
|
|
31
|
+
readonly type: "custom";
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly description: string;
|
|
34
|
+
readonly format: {
|
|
35
|
+
readonly type: "text";
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: "grammar";
|
|
38
|
+
readonly syntax: "lark" | "regex";
|
|
39
|
+
readonly definition: string;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "function";
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly description: string;
|
|
45
|
+
readonly parameters: {
|
|
46
|
+
readonly [x: string]: unknown;
|
|
47
|
+
};
|
|
48
|
+
readonly strict?: boolean | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
readonly [x: string]: unknown;
|
|
51
|
+
readonly type: string;
|
|
52
|
+
})[];
|
|
27
53
|
} | {
|
|
28
54
|
readonly type: "message";
|
|
29
55
|
readonly role: "system";
|
|
@@ -182,7 +182,7 @@ export declare const configure: (input?: Config) => {
|
|
|
182
182
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
183
183
|
}, import("../route.js").CompactionOperations | undefined>;
|
|
184
184
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
185
|
-
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
185
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
186
186
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
187
187
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
188
188
|
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
@@ -201,7 +201,7 @@ export declare const provider: {
|
|
|
201
201
|
readonly serviceTier?: import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard"> | undefined;
|
|
202
202
|
}, import("../route.js").CompactionOperations | undefined>;
|
|
203
203
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
204
|
-
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
204
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
205
205
|
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/google-speech.js").GoogleSpeechOptions>;
|
|
206
206
|
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/google-transcription.js").GoogleTranscriptionOptions>;
|
|
207
207
|
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
@@ -214,7 +214,7 @@ export declare const videoModel: (modelID: string, settings?: Settings) => impor
|
|
|
214
214
|
export declare const embeddingModel: (modelID: string, settings?: Settings) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
215
215
|
export declare const decisionModel: (modelID: string, settings?: Settings) => import("../decision.js").DecisionModel<GoogleDecisions.OptionsInput>;
|
|
216
216
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
217
|
-
export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
217
|
+
export declare const video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/google-interactions-video.js").GoogleVideoOptions>;
|
|
218
218
|
export declare const embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<GoogleEmbeddingOptionsInput>;
|
|
219
219
|
export declare const gemini: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
220
220
|
export declare const interactions: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
package/dist/providers/google.js
CHANGED
|
@@ -39,7 +39,7 @@ export const configure = (input = {}) => {
|
|
|
39
39
|
gemini,
|
|
40
40
|
interactions: (modelID) => interactionsRoute(input).model({ id: modelID }),
|
|
41
41
|
image: (modelID, providerOptions) => GoogleImages.model({ ...media, id: modelID, providerOptions }),
|
|
42
|
-
video: (modelID) => GoogleInteractionsVideo.model({ ...media, id: modelID }),
|
|
42
|
+
video: (modelID, providerOptions) => GoogleInteractionsVideo.model({ ...media, id: modelID, providerOptions }),
|
|
43
43
|
speech: (modelID) => GoogleSpeech.model({ ...media, id: modelID }),
|
|
44
44
|
transcription: (modelID) => GoogleTranscription.model({ ...media, id: modelID }),
|
|
45
45
|
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
@@ -55,7 +55,10 @@ export const imageModel = (modelID, settings) => {
|
|
|
55
55
|
const input = toConfig(settings);
|
|
56
56
|
return configure(input).image(modelID, input.providerOptions);
|
|
57
57
|
};
|
|
58
|
-
export const videoModel = (modelID, settings) =>
|
|
58
|
+
export const videoModel = (modelID, settings) => {
|
|
59
|
+
const input = toConfig(settings);
|
|
60
|
+
return configure(input).video(modelID, input.providerOptions);
|
|
61
|
+
};
|
|
59
62
|
export const embeddingModel = (modelID, settings) => {
|
|
60
63
|
const input = toConfig(settings);
|
|
61
64
|
return configure(input).embedding(modelID, input.providerOptions);
|
package/dist/providers/meta.d.ts
CHANGED
|
@@ -45,6 +45,32 @@ export declare const routes: (Route<{
|
|
|
45
45
|
readonly reasoning: {
|
|
46
46
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
47
47
|
};
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "additional_tools";
|
|
50
|
+
readonly role: "developer";
|
|
51
|
+
readonly tools: readonly ({
|
|
52
|
+
readonly type: "custom";
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly description: string;
|
|
55
|
+
readonly format: {
|
|
56
|
+
readonly type: "text";
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "grammar";
|
|
59
|
+
readonly syntax: "lark" | "regex";
|
|
60
|
+
readonly definition: string;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "function";
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly description: string;
|
|
66
|
+
readonly parameters: {
|
|
67
|
+
readonly [x: string]: unknown;
|
|
68
|
+
};
|
|
69
|
+
readonly strict?: boolean | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
readonly [x: string]: unknown;
|
|
72
|
+
readonly type: string;
|
|
73
|
+
})[];
|
|
48
74
|
} | {
|
|
49
75
|
readonly type: "message";
|
|
50
76
|
readonly role: "system";
|
|
@@ -638,14 +664,36 @@ export declare const routes: (Route<{
|
|
|
638
664
|
})[];
|
|
639
665
|
} | {
|
|
640
666
|
readonly role: "system";
|
|
641
|
-
readonly content: readonly {
|
|
667
|
+
readonly content: readonly ({
|
|
668
|
+
readonly type: "tool_addition";
|
|
669
|
+
readonly tool: {
|
|
670
|
+
readonly type: "tool_definition";
|
|
671
|
+
readonly definition: {
|
|
672
|
+
readonly name: string;
|
|
673
|
+
readonly description: string;
|
|
674
|
+
readonly input_schema: {
|
|
675
|
+
readonly [x: string]: unknown;
|
|
676
|
+
};
|
|
677
|
+
readonly cache_control?: {
|
|
678
|
+
readonly type: "ephemeral";
|
|
679
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
680
|
+
} | undefined;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
} | {
|
|
684
|
+
readonly type: "tool_removal";
|
|
685
|
+
readonly tool: {
|
|
686
|
+
readonly type: "tool_reference";
|
|
687
|
+
readonly name: string;
|
|
688
|
+
};
|
|
689
|
+
} | {
|
|
642
690
|
readonly type: "text";
|
|
643
691
|
readonly text: string;
|
|
644
692
|
readonly cache_control?: {
|
|
645
693
|
readonly type: "ephemeral";
|
|
646
694
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
647
695
|
} | undefined;
|
|
648
|
-
}[];
|
|
696
|
+
})[];
|
|
649
697
|
readonly output_config?: {
|
|
650
698
|
readonly effort: string;
|
|
651
699
|
} | undefined;
|
|
@@ -265,14 +265,36 @@ export declare const routes: (Route<{
|
|
|
265
265
|
})[];
|
|
266
266
|
} | {
|
|
267
267
|
readonly role: "system";
|
|
268
|
-
readonly content: readonly {
|
|
268
|
+
readonly content: readonly ({
|
|
269
|
+
readonly type: "tool_addition";
|
|
270
|
+
readonly tool: {
|
|
271
|
+
readonly type: "tool_definition";
|
|
272
|
+
readonly definition: {
|
|
273
|
+
readonly name: string;
|
|
274
|
+
readonly description: string;
|
|
275
|
+
readonly input_schema: {
|
|
276
|
+
readonly [x: string]: unknown;
|
|
277
|
+
};
|
|
278
|
+
readonly cache_control?: {
|
|
279
|
+
readonly type: "ephemeral";
|
|
280
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
281
|
+
} | undefined;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
} | {
|
|
285
|
+
readonly type: "tool_removal";
|
|
286
|
+
readonly tool: {
|
|
287
|
+
readonly type: "tool_reference";
|
|
288
|
+
readonly name: string;
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
269
291
|
readonly type: "text";
|
|
270
292
|
readonly text: string;
|
|
271
293
|
readonly cache_control?: {
|
|
272
294
|
readonly type: "ephemeral";
|
|
273
295
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
274
296
|
} | undefined;
|
|
275
|
-
}[];
|
|
297
|
+
})[];
|
|
276
298
|
readonly output_config?: {
|
|
277
299
|
readonly effort: string;
|
|
278
300
|
} | undefined;
|
|
@@ -350,6 +372,32 @@ export declare const routes: (Route<{
|
|
|
350
372
|
readonly reasoning: {
|
|
351
373
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
352
374
|
};
|
|
375
|
+
} | {
|
|
376
|
+
readonly type: "additional_tools";
|
|
377
|
+
readonly role: "developer";
|
|
378
|
+
readonly tools: readonly ({
|
|
379
|
+
readonly type: "custom";
|
|
380
|
+
readonly name: string;
|
|
381
|
+
readonly description: string;
|
|
382
|
+
readonly format: {
|
|
383
|
+
readonly type: "text";
|
|
384
|
+
} | {
|
|
385
|
+
readonly type: "grammar";
|
|
386
|
+
readonly syntax: "lark" | "regex";
|
|
387
|
+
readonly definition: string;
|
|
388
|
+
};
|
|
389
|
+
} | {
|
|
390
|
+
readonly type: "function";
|
|
391
|
+
readonly name: string;
|
|
392
|
+
readonly description: string;
|
|
393
|
+
readonly parameters: {
|
|
394
|
+
readonly [x: string]: unknown;
|
|
395
|
+
};
|
|
396
|
+
readonly strict?: boolean | undefined;
|
|
397
|
+
} | {
|
|
398
|
+
readonly [x: string]: unknown;
|
|
399
|
+
readonly type: string;
|
|
400
|
+
})[];
|
|
353
401
|
} | {
|
|
354
402
|
readonly type: "message";
|
|
355
403
|
readonly role: "system";
|
|
@@ -260,14 +260,36 @@ export declare const routes: (Route<{
|
|
|
260
260
|
})[];
|
|
261
261
|
} | {
|
|
262
262
|
readonly role: "system";
|
|
263
|
-
readonly content: readonly {
|
|
263
|
+
readonly content: readonly ({
|
|
264
|
+
readonly type: "tool_addition";
|
|
265
|
+
readonly tool: {
|
|
266
|
+
readonly type: "tool_definition";
|
|
267
|
+
readonly definition: {
|
|
268
|
+
readonly name: string;
|
|
269
|
+
readonly description: string;
|
|
270
|
+
readonly input_schema: {
|
|
271
|
+
readonly [x: string]: unknown;
|
|
272
|
+
};
|
|
273
|
+
readonly cache_control?: {
|
|
274
|
+
readonly type: "ephemeral";
|
|
275
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
276
|
+
} | undefined;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
} | {
|
|
280
|
+
readonly type: "tool_removal";
|
|
281
|
+
readonly tool: {
|
|
282
|
+
readonly type: "tool_reference";
|
|
283
|
+
readonly name: string;
|
|
284
|
+
};
|
|
285
|
+
} | {
|
|
264
286
|
readonly type: "text";
|
|
265
287
|
readonly text: string;
|
|
266
288
|
readonly cache_control?: {
|
|
267
289
|
readonly type: "ephemeral";
|
|
268
290
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
269
291
|
} | undefined;
|
|
270
|
-
}[];
|
|
292
|
+
})[];
|
|
271
293
|
readonly output_config?: {
|
|
272
294
|
readonly effort: string;
|
|
273
295
|
} | undefined;
|
|
@@ -345,6 +367,32 @@ export declare const routes: (Route<{
|
|
|
345
367
|
readonly reasoning: {
|
|
346
368
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
347
369
|
};
|
|
370
|
+
} | {
|
|
371
|
+
readonly type: "additional_tools";
|
|
372
|
+
readonly role: "developer";
|
|
373
|
+
readonly tools: readonly ({
|
|
374
|
+
readonly type: "custom";
|
|
375
|
+
readonly name: string;
|
|
376
|
+
readonly description: string;
|
|
377
|
+
readonly format: {
|
|
378
|
+
readonly type: "text";
|
|
379
|
+
} | {
|
|
380
|
+
readonly type: "grammar";
|
|
381
|
+
readonly syntax: "lark" | "regex";
|
|
382
|
+
readonly definition: string;
|
|
383
|
+
};
|
|
384
|
+
} | {
|
|
385
|
+
readonly type: "function";
|
|
386
|
+
readonly name: string;
|
|
387
|
+
readonly description: string;
|
|
388
|
+
readonly parameters: {
|
|
389
|
+
readonly [x: string]: unknown;
|
|
390
|
+
};
|
|
391
|
+
readonly strict?: boolean | undefined;
|
|
392
|
+
} | {
|
|
393
|
+
readonly [x: string]: unknown;
|
|
394
|
+
readonly type: string;
|
|
395
|
+
})[];
|
|
348
396
|
} | {
|
|
349
397
|
readonly type: "message";
|
|
350
398
|
readonly role: "system";
|
|
@@ -21,6 +21,32 @@ export declare const routes: import("../route.js").Route<{
|
|
|
21
21
|
readonly reasoning: {
|
|
22
22
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
23
23
|
};
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "additional_tools";
|
|
26
|
+
readonly role: "developer";
|
|
27
|
+
readonly tools: readonly ({
|
|
28
|
+
readonly type: "custom";
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly description: string;
|
|
31
|
+
readonly format: {
|
|
32
|
+
readonly type: "text";
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "grammar";
|
|
35
|
+
readonly syntax: "lark" | "regex";
|
|
36
|
+
readonly definition: string;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "function";
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly description: string;
|
|
42
|
+
readonly parameters: {
|
|
43
|
+
readonly [x: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
readonly strict?: boolean | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
readonly [x: string]: unknown;
|
|
48
|
+
readonly type: string;
|
|
49
|
+
})[];
|
|
24
50
|
} | {
|
|
25
51
|
readonly type: "message";
|
|
26
52
|
readonly role: "system";
|
|
@@ -194,6 +194,32 @@ export declare const routes: (Route<{
|
|
|
194
194
|
readonly reasoning: {
|
|
195
195
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
196
196
|
};
|
|
197
|
+
} | {
|
|
198
|
+
readonly type: "additional_tools";
|
|
199
|
+
readonly role: "developer";
|
|
200
|
+
readonly tools: readonly ({
|
|
201
|
+
readonly type: "custom";
|
|
202
|
+
readonly name: string;
|
|
203
|
+
readonly description: string;
|
|
204
|
+
readonly format: {
|
|
205
|
+
readonly type: "text";
|
|
206
|
+
} | {
|
|
207
|
+
readonly type: "grammar";
|
|
208
|
+
readonly syntax: "lark" | "regex";
|
|
209
|
+
readonly definition: string;
|
|
210
|
+
};
|
|
211
|
+
} | {
|
|
212
|
+
readonly type: "function";
|
|
213
|
+
readonly name: string;
|
|
214
|
+
readonly description: string;
|
|
215
|
+
readonly parameters: {
|
|
216
|
+
readonly [x: string]: unknown;
|
|
217
|
+
};
|
|
218
|
+
readonly strict?: boolean | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
readonly [x: string]: unknown;
|
|
221
|
+
readonly type: string;
|
|
222
|
+
})[];
|
|
197
223
|
} | {
|
|
198
224
|
readonly type: "message";
|
|
199
225
|
readonly role: "system";
|
|
@@ -747,6 +747,32 @@ export declare const routes: (Route<{
|
|
|
747
747
|
readonly reasoning: {
|
|
748
748
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
749
749
|
};
|
|
750
|
+
} | {
|
|
751
|
+
readonly type: "additional_tools";
|
|
752
|
+
readonly role: "developer";
|
|
753
|
+
readonly tools: readonly ({
|
|
754
|
+
readonly type: "custom";
|
|
755
|
+
readonly name: string;
|
|
756
|
+
readonly description: string;
|
|
757
|
+
readonly format: {
|
|
758
|
+
readonly type: "text";
|
|
759
|
+
} | {
|
|
760
|
+
readonly type: "grammar";
|
|
761
|
+
readonly syntax: "lark" | "regex";
|
|
762
|
+
readonly definition: string;
|
|
763
|
+
};
|
|
764
|
+
} | {
|
|
765
|
+
readonly type: "function";
|
|
766
|
+
readonly name: string;
|
|
767
|
+
readonly description: string;
|
|
768
|
+
readonly parameters: {
|
|
769
|
+
readonly [x: string]: unknown;
|
|
770
|
+
};
|
|
771
|
+
readonly strict?: boolean | undefined;
|
|
772
|
+
} | {
|
|
773
|
+
readonly [x: string]: unknown;
|
|
774
|
+
readonly type: string;
|
|
775
|
+
})[];
|
|
750
776
|
} | {
|
|
751
777
|
readonly type: "message";
|
|
752
778
|
readonly role: "system";
|
|
@@ -23,6 +23,32 @@ export declare const routes: (Route<{
|
|
|
23
23
|
readonly reasoning: {
|
|
24
24
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
25
25
|
};
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: "additional_tools";
|
|
28
|
+
readonly role: "developer";
|
|
29
|
+
readonly tools: readonly ({
|
|
30
|
+
readonly type: "custom";
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly description: string;
|
|
33
|
+
readonly format: {
|
|
34
|
+
readonly type: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "grammar";
|
|
37
|
+
readonly syntax: "lark" | "regex";
|
|
38
|
+
readonly definition: string;
|
|
39
|
+
};
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly description: string;
|
|
44
|
+
readonly parameters: {
|
|
45
|
+
readonly [x: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
readonly strict?: boolean | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
readonly [x: string]: unknown;
|
|
50
|
+
readonly type: string;
|
|
51
|
+
})[];
|
|
26
52
|
} | {
|
|
27
53
|
readonly type: "message";
|
|
28
54
|
readonly role: "system";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { videoModel as model } from "../xai.js";
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -208,7 +208,7 @@ export declare const configure: (input?: Config) => {
|
|
|
208
208
|
}>;
|
|
209
209
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
210
210
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
211
|
-
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
211
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
212
212
|
configure: typeof configure;
|
|
213
213
|
};
|
|
214
214
|
export declare const provider: {
|
|
@@ -221,14 +221,15 @@ export declare const provider: {
|
|
|
221
221
|
}>;
|
|
222
222
|
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
223
223
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
224
|
-
video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
224
|
+
video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
225
225
|
configure: typeof configure;
|
|
226
226
|
};
|
|
227
227
|
export declare const model: ProviderPackage.Model<Settings, XAIProviderOptionsInput, typeof responsesRoute.compact>;
|
|
228
228
|
export declare const imageModel: (modelID: string, settings?: Settings) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
229
|
+
export declare const videoModel: (modelID: string, settings?: Settings) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
229
230
|
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, {
|
|
230
231
|
endpoint: import("../route/client.js").CompactOperation;
|
|
231
232
|
}>;
|
|
232
233
|
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<XAIProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
233
234
|
export declare const image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
234
|
-
export declare const video: (modelID: string | ModelID) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
|
235
|
+
export declare const video: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../video.js").VideoModel<import("../protocols/xai-video.js").XAIVideoOptions>;
|
package/dist/providers/xai.js
CHANGED
|
@@ -69,7 +69,7 @@ export const configure = (input = {}) => {
|
|
|
69
69
|
responses,
|
|
70
70
|
chat,
|
|
71
71
|
image: (modelID, providerOptions) => XAIImages.model({ ...media, id: modelID, providerOptions }),
|
|
72
|
-
video: (modelID) => XAIVideo.model({ ...media, id: modelID }),
|
|
72
|
+
video: (modelID, providerOptions) => XAIVideo.model({ ...media, id: modelID, providerOptions }),
|
|
73
73
|
configure,
|
|
74
74
|
};
|
|
75
75
|
};
|
|
@@ -79,6 +79,10 @@ export const imageModel = (modelID, settings) => {
|
|
|
79
79
|
const input = toConfig(settings);
|
|
80
80
|
return configure(input).image(modelID, input.providerOptions);
|
|
81
81
|
};
|
|
82
|
+
export const videoModel = (modelID, settings) => {
|
|
83
|
+
const input = toConfig(settings);
|
|
84
|
+
return configure(input).video(modelID, input.providerOptions);
|
|
85
|
+
};
|
|
82
86
|
export const responses = provider.responses;
|
|
83
87
|
export const chat = provider.chat;
|
|
84
88
|
export const image = provider.image;
|
|
@@ -26,6 +26,32 @@ export declare const routes: (Route<{
|
|
|
26
26
|
readonly reasoning: {
|
|
27
27
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
28
28
|
};
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "additional_tools";
|
|
31
|
+
readonly role: "developer";
|
|
32
|
+
readonly tools: readonly ({
|
|
33
|
+
readonly type: "custom";
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly description: string;
|
|
36
|
+
readonly format: {
|
|
37
|
+
readonly type: "text";
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "grammar";
|
|
40
|
+
readonly syntax: "lark" | "regex";
|
|
41
|
+
readonly definition: string;
|
|
42
|
+
};
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: "function";
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly description: string;
|
|
47
|
+
readonly parameters: {
|
|
48
|
+
readonly [x: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
readonly strict?: boolean | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
readonly [x: string]: unknown;
|
|
53
|
+
readonly type: string;
|
|
54
|
+
})[];
|
|
29
55
|
} | {
|
|
30
56
|
readonly type: "message";
|
|
31
57
|
readonly role: "system";
|
|
@@ -629,14 +655,36 @@ export declare const routes: (Route<{
|
|
|
629
655
|
})[];
|
|
630
656
|
} | {
|
|
631
657
|
readonly role: "system";
|
|
632
|
-
readonly content: readonly {
|
|
658
|
+
readonly content: readonly ({
|
|
659
|
+
readonly type: "tool_addition";
|
|
660
|
+
readonly tool: {
|
|
661
|
+
readonly type: "tool_definition";
|
|
662
|
+
readonly definition: {
|
|
663
|
+
readonly name: string;
|
|
664
|
+
readonly description: string;
|
|
665
|
+
readonly input_schema: {
|
|
666
|
+
readonly [x: string]: unknown;
|
|
667
|
+
};
|
|
668
|
+
readonly cache_control?: {
|
|
669
|
+
readonly type: "ephemeral";
|
|
670
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
671
|
+
} | undefined;
|
|
672
|
+
};
|
|
673
|
+
};
|
|
674
|
+
} | {
|
|
675
|
+
readonly type: "tool_removal";
|
|
676
|
+
readonly tool: {
|
|
677
|
+
readonly type: "tool_reference";
|
|
678
|
+
readonly name: string;
|
|
679
|
+
};
|
|
680
|
+
} | {
|
|
633
681
|
readonly type: "text";
|
|
634
682
|
readonly text: string;
|
|
635
683
|
readonly cache_control?: {
|
|
636
684
|
readonly type: "ephemeral";
|
|
637
685
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
638
686
|
} | undefined;
|
|
639
|
-
}[];
|
|
687
|
+
})[];
|
|
640
688
|
readonly output_config?: {
|
|
641
689
|
readonly effort: string;
|
|
642
690
|
} | undefined;
|
package/dist/public.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { isContextOverflow, isContextOverflowFailure, isRetryable } from "./provider-error.js";
|
|
2
|
-
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, GENERATION_KEYS, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, Message, SystemMessage, UserMessage, AssistantMessage, ToolMessage, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, FinishReasonDetails, StepFinish, Finish, MediaEvent, RawEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
2
|
+
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, GENERATION_KEYS, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, ToolChanges, Message, SystemMessage, UserMessage, AssistantMessage, ToolMessage, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, FinishReasonDetails, StepFinish, Finish, MediaEvent, RawEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
3
3
|
export type { BaseRequest, ContentPartInput, GenerationOptionsFields, HttpOptions, RequestOptions, LanguageModelInput, LanguageModelProviderOptions, LLMRequest, MediaPartInput, RequestTimeout, TimeoutConfig, ToolDefinitionInput, ToolNamespaceInput, ToolNamespaceEntryInput, ToolEntryInput, TransportOptions, UsageInput, } from "./schema/index.js";
|
|
4
4
|
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageResponse } from "./image.js";
|
|
5
|
-
export type { ImageModelOptions, ImageOptions, ImageRequest, ImageRequestInput, ImageResolution, ImageRoute, } from "./image.js";
|
|
5
|
+
export type { ImageJob, ImageModelOptions, ImageOptions, ImageRequest, ImageRequestInput, ImageResolution, ImageRoute, ImageStatus, } from "./image.js";
|
|
6
6
|
export { VideoAspectRatio, VideoDuration, VideoModel, VideoModelSchema, VideoResponse } from "./video.js";
|
|
7
7
|
export type { VideoJob, VideoModelOptions, VideoOptions, VideoRequest, VideoRequestInput, VideoResolution, VideoRoute, VideoStatus, } from "./video.js";
|
|
8
8
|
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
|
@@ -10,7 +10,8 @@ export type { AnswerFor, AnswersFor, DecisionInput, DecisionMediaPartInput, Deci
|
|
|
10
10
|
export { EmbeddingModel, EmbeddingModelSchema, EmbeddingResponse, EmbeddingUsage, EmbeddingValue } from "./embedding.js";
|
|
11
11
|
export type { EmbeddingInputType, EmbeddingModelOptions, EmbeddingModelRoute, EmbeddingOptions, EmbeddingRequest, EmbeddingRequestInput, EmbeddingValueInput, } from "./embedding.js";
|
|
12
12
|
export { Media } from "./media.js";
|
|
13
|
-
export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
|
|
14
|
-
export type { ExecutableTool, Tool, ToolExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolModelOutputInput, ToolOptions, ToolSchema, ToolToModelOutput, } from "./tool.js";
|
|
13
|
+
export type { AwaitOptions as GenerationAwaitOptions, Event as GenerationEvent, Poll, Reason as GenerationReason, Route as GenerationRoute, Snapshot as GenerationSnapshot, Status as GenerationStatus, } from "./generation.js";
|
|
14
|
+
export type { ExecutableTool, Tool, ToolChangesInput, ToolExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolModelOutputInput, ToolOptions, ToolSchema, ToolToModelOutput, } from "./tool.js";
|
|
15
15
|
export type { LLM } from "./llm.js";
|
|
16
16
|
export type { LLMLoopInput, LLMRequestInput } from "./llm.js";
|
|
17
|
+
export type { HttpHandler, HttpMiddleware } from "./route/executor-service.js";
|
package/dist/public.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isContextOverflow, isContextOverflowFailure, isRetryable } from "./provider-error.js";
|
|
2
|
-
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, GENERATION_KEYS, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, Message, SystemMessage, UserMessage, AssistantMessage, ToolMessage, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, FinishReasonDetails, StepFinish, Finish, MediaEvent, RawEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
2
|
+
export { ProtocolID, RouteID, ModelID, ProviderID, ResponseID, ContentBlockID, ToolCallID, JsonSchema, ProviderOptions, ProviderMetadata, HttpTimeout, RequestEncoding, GENERATION_KEYS, ReasoningEfforts, ReasoningEffort, LanguageModelCompatibility, LanguageModel, LanguageModelSchema, CacheTTL, CacheHint, CachePolicyObject, CachePolicy, MessageRole, SystemPart, TextPart, MediaPart, ToolResultValue, ToolOutput, ToolCallPart, ToolResultPart, ReasoningPart, CompactionPart, EffortPart, ContentPart, ToolChanges, Message, SystemMessage, UserMessage, AssistantMessage, ToolMessage, Freeform, ToolDefinition, ToolNamespace, ToolEntry, ToolChoice, FinishReason, Usage, MediaUsage, CompactionResponse, CompactionCheckpointResponse, StepStart, TextStart, TextDelta, TextEnd, ReasoningStart, ReasoningDelta, ReasoningEnd, ToolInputStart, ToolInputDelta, ToolInputEnd, ToolInputError, ToolCall, ToolResult, FinishReasonDetails, StepFinish, Finish, MediaEvent, RawEvent, LLMEvent, LLMResponse, HttpContext, HttpRateLimitDetails, InvalidRequestError, UnsupportedOperationError, ProviderConfigurationError, AuthenticationError, RateLimitError, QuotaExceededError, ContentPolicyError, ProviderInternalError, TransportType, TransportOperation, TransportError, InvalidProviderOutputError, UnknownProviderError, TimeoutError, AIErrorReason, AIError, } from "./schema/index.js";
|
|
3
3
|
export { ImageAspectRatio, ImageEvent, ImageModel, ImageModelSchema, ImageResponse } from "./image.js";
|
|
4
4
|
export { VideoAspectRatio, VideoDuration, VideoModel, VideoModelSchema, VideoResponse } from "./video.js";
|
|
5
5
|
export { ChoiceAnswer, ChoiceQuestion, ChoiceValue, DecisionAnswer, DecisionJsonPart, DecisionMediaPart, DecisionModel, DecisionModelCompatibility, DecisionModelSchema, DecisionPart, DecisionQuestion, DecisionResponse, DecisionTextPart, DecisionUsage, ErrorAnswer, ErrorReason, PredicateAnswer, PredicateQuestion, ScoreAnswer, ScoreQuestion, } from "./decision.js";
|
package/dist/route/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Framing } from "./framing.js";
|
|
|
6
6
|
import { HttpTransport } from "./transport/index.js";
|
|
7
7
|
import type { HttpMiddleware, Transport, TransportRuntime, WebSocketChannelExecutor } from "./transport/index.js";
|
|
8
8
|
import type { Protocol } from "./protocol.js";
|
|
9
|
+
import { type ToolUpdateEncoding } from "../tool-updates.js";
|
|
9
10
|
import type { LanguageModelSanitizerCompatibility, ProtocolID, ProviderOptions } from "../schema/index.js";
|
|
10
11
|
import type { LLMRequestInput } from "../llm.js";
|
|
11
12
|
import { AIError, CompactionResponse, CompactionCheckpointResponse, LLMResponse, LanguageModel, LLMEvent, ProviderID, type LLMRequest, type RequestOptions } from "../schema/index.js";
|
|
@@ -33,6 +34,7 @@ export interface Route<Body, Prepared = unknown, Compact extends CompactionOpera
|
|
|
33
34
|
readonly options?: RequestOptions;
|
|
34
35
|
readonly body: RouteBody<Body>;
|
|
35
36
|
readonly supportsEffortUpdates?: (request: LLMRequest) => boolean;
|
|
37
|
+
readonly toolUpdates?: ToolUpdateEncoding;
|
|
36
38
|
readonly sanitizer?: LanguageModelSanitizerCompatibility;
|
|
37
39
|
readonly with: {
|
|
38
40
|
<Next extends CompactionOperations | undefined>(patch: RoutePatch<Body, Prepared> & {
|
package/dist/route/client.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Framing } from "./framing.js";
|
|
|
6
6
|
import { HttpTransport } from "./transport/index.js";
|
|
7
7
|
import { applyCachePolicy } from "../cache-policy.js";
|
|
8
8
|
import { applyEffortUpdates } from "../effort-updates.js";
|
|
9
|
+
import { mapToolUpdates, planToolUpdates } from "../tool-updates.js";
|
|
9
10
|
import { normalizeToolHistory } from "../tool-history.js";
|
|
10
11
|
import { sanitizeSurrogates } from "../utils/sanitize.js";
|
|
11
12
|
import * as ProviderShared from "../protocols/shared.js";
|
|
@@ -108,6 +109,7 @@ function makeFromTransport(input) {
|
|
|
108
109
|
options: routeInput.options,
|
|
109
110
|
body: protocol.body,
|
|
110
111
|
supportsEffortUpdates: protocol.supportsEffortUpdates,
|
|
112
|
+
toolUpdates: protocol.toolUpdates,
|
|
111
113
|
sanitizer: protocol.sanitizer,
|
|
112
114
|
with: (patch) => {
|
|
113
115
|
const { compact, id, provider, providerMetadataKey, auth, transport, endpoint, ...options } = patch;
|
|
@@ -201,7 +203,9 @@ const prepareRequest = (request) => {
|
|
|
201
203
|
const sanitized = restoreClasses({ ...sanitizeSurrogates({ ...original, model: undefined }), model: original.model });
|
|
202
204
|
// Deduplicate per sibling level; a tool and a namespace may share a name.
|
|
203
205
|
const dedupe = (tools) => [...new Map(tools.map((tool) => [`${tool.type}:${tool.name}`, tool])).values()].map((tool) => tool.type === "tool" ? tool : { ...tool, tools: dedupe(tool.tools) });
|
|
204
|
-
const
|
|
206
|
+
const project = (tools) => ToolSchemaProjection.tools(dedupe(tools), sanitized.model);
|
|
207
|
+
const updated = planToolUpdates(sanitized);
|
|
208
|
+
const resolved = applyCachePolicy(applyEffortUpdates(mapToolUpdates({ ...updated, tools: project(updated.tools) }, project)));
|
|
205
209
|
const headers = resolved.model.route.headers?.({ request: resolved });
|
|
206
210
|
return headers === undefined ? resolved : { ...resolved, headers: { ...headers, ...resolved.headers } };
|
|
207
211
|
};
|