@ai-sdk/anthropic 3.0.133 → 3.0.135
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/CHANGELOG.md +16 -0
- package/dist/index.d.mts +121 -156
- package/dist/index.d.ts +121 -156
- package/dist/index.js +569 -537
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +526 -491
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +175 -139
- package/dist/internal/index.d.ts +175 -139
- package/dist/internal/index.js +562 -530
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +525 -490
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-api.ts +73 -57
- package/src/anthropic-messages-language-model.ts +31 -8
- package/src/anthropic-messages-options.ts +386 -367
- package/src/convert-to-anthropic-messages-prompt.ts +22 -0
- package/src/get-cache-control.ts +15 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -44,13 +44,13 @@ import {
|
|
|
44
44
|
zodSchema as zodSchema2
|
|
45
45
|
} from "@ai-sdk/provider-utils";
|
|
46
46
|
import { z as z2 } from "zod/v4";
|
|
47
|
-
var anthropicStopDetailsSchema = z2.object({
|
|
47
|
+
var anthropicStopDetailsSchema = () => z2.object({
|
|
48
48
|
type: z2.string(),
|
|
49
49
|
category: z2.string().nullish(),
|
|
50
50
|
explanation: z2.string().nullish(),
|
|
51
51
|
recommended_model: z2.string().nullish()
|
|
52
52
|
});
|
|
53
|
-
var anthropicSafeguardResultSchema = z2.object({
|
|
53
|
+
var anthropicSafeguardResultSchema = () => z2.object({
|
|
54
54
|
type: z2.string(),
|
|
55
55
|
status: z2.object({
|
|
56
56
|
type: z2.string(),
|
|
@@ -64,7 +64,7 @@ var anthropicSafeguardResultSchema = z2.object({
|
|
|
64
64
|
).nullish()
|
|
65
65
|
})
|
|
66
66
|
});
|
|
67
|
-
var anthropicToolCallCallerSchema = z2.union([
|
|
67
|
+
var anthropicToolCallCallerSchema = () => z2.union([
|
|
68
68
|
z2.object({
|
|
69
69
|
type: z2.literal("code_execution_20250825"),
|
|
70
70
|
tool_id: z2.string()
|
|
@@ -77,7 +77,7 @@ var anthropicToolCallCallerSchema = z2.union([
|
|
|
77
77
|
type: z2.literal("direct")
|
|
78
78
|
})
|
|
79
79
|
]);
|
|
80
|
-
var anthropicInputTransformationSchema = z2.object({
|
|
80
|
+
var anthropicInputTransformationSchema = () => z2.object({
|
|
81
81
|
type: z2.string(),
|
|
82
82
|
path: z2.string(),
|
|
83
83
|
reason: z2.string()
|
|
@@ -140,7 +140,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
140
140
|
name: z2.string(),
|
|
141
141
|
input: z2.unknown(),
|
|
142
142
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
143
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
143
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
144
144
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
145
145
|
toolset_name: z2.string().nullish()
|
|
146
146
|
}),
|
|
@@ -149,7 +149,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
149
149
|
id: z2.string(),
|
|
150
150
|
name: z2.string(),
|
|
151
151
|
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
152
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
152
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
153
153
|
}),
|
|
154
154
|
z2.object({
|
|
155
155
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -172,7 +172,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
172
172
|
z2.object({
|
|
173
173
|
type: z2.literal("web_fetch_tool_result"),
|
|
174
174
|
tool_use_id: z2.string(),
|
|
175
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
175
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
176
176
|
content: z2.union([
|
|
177
177
|
z2.object({
|
|
178
178
|
type: z2.literal("web_fetch_result"),
|
|
@@ -205,7 +205,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
205
205
|
z2.object({
|
|
206
206
|
type: z2.literal("web_search_tool_result"),
|
|
207
207
|
tool_use_id: z2.string(),
|
|
208
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
208
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
209
209
|
content: z2.union([
|
|
210
210
|
z2.array(
|
|
211
211
|
z2.object({
|
|
@@ -362,9 +362,9 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
362
362
|
),
|
|
363
363
|
stop_reason: z2.string().nullish(),
|
|
364
364
|
stop_sequence: z2.string().nullish(),
|
|
365
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
366
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
367
|
-
safeguard_results: z2.array(anthropicSafeguardResultSchema).nullish(),
|
|
365
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
366
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
367
|
+
safeguard_results: z2.array(anthropicSafeguardResultSchema()).nullish(),
|
|
368
368
|
usage: z2.looseObject({
|
|
369
369
|
input_tokens: z2.number(),
|
|
370
370
|
output_tokens: z2.number(),
|
|
@@ -444,13 +444,13 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
444
444
|
id: z2.string(),
|
|
445
445
|
name: z2.string(),
|
|
446
446
|
input: z2.unknown(),
|
|
447
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
447
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
448
448
|
toolset_name: z2.string().nullish()
|
|
449
449
|
})
|
|
450
450
|
])
|
|
451
451
|
).nullish(),
|
|
452
452
|
stop_reason: z2.string().nullish(),
|
|
453
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
453
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
454
454
|
container: z2.object({
|
|
455
455
|
expires_at: z2.string(),
|
|
456
456
|
id: z2.string()
|
|
@@ -476,7 +476,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
476
476
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
477
477
|
input: z2.record(z2.string(), z2.unknown()).optional(),
|
|
478
478
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
479
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
479
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
480
480
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
481
481
|
toolset_name: z2.string().nullish()
|
|
482
482
|
}),
|
|
@@ -493,7 +493,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
493
493
|
id: z2.string(),
|
|
494
494
|
name: z2.string(),
|
|
495
495
|
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
496
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
496
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
497
497
|
}),
|
|
498
498
|
z2.object({
|
|
499
499
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -516,7 +516,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
516
516
|
z2.object({
|
|
517
517
|
type: z2.literal("web_fetch_tool_result"),
|
|
518
518
|
tool_use_id: z2.string(),
|
|
519
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
519
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
520
520
|
content: z2.union([
|
|
521
521
|
z2.object({
|
|
522
522
|
type: z2.literal("web_fetch_result"),
|
|
@@ -549,7 +549,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
549
549
|
z2.object({
|
|
550
550
|
type: z2.literal("web_search_tool_result"),
|
|
551
551
|
tool_use_id: z2.string(),
|
|
552
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
552
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
553
553
|
content: z2.union([
|
|
554
554
|
z2.array(
|
|
555
555
|
z2.object({
|
|
@@ -773,8 +773,8 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
773
773
|
delta: z2.object({
|
|
774
774
|
stop_reason: z2.string().nullish(),
|
|
775
775
|
stop_sequence: z2.string().nullish(),
|
|
776
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
777
|
-
safeguard_results: z2.array(anthropicSafeguardResultSchema).nullish(),
|
|
776
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
777
|
+
safeguard_results: z2.array(anthropicSafeguardResultSchema()).nullish(),
|
|
778
778
|
container: z2.object({
|
|
779
779
|
expires_at: z2.string(),
|
|
780
780
|
id: z2.string(),
|
|
@@ -814,7 +814,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
814
814
|
})
|
|
815
815
|
).nullish()
|
|
816
816
|
}),
|
|
817
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
817
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
818
818
|
context_management: z2.object({
|
|
819
819
|
applied_edits: z2.array(
|
|
820
820
|
z2.union([
|
|
@@ -854,349 +854,365 @@ var anthropicReasoningMetadataSchema = lazySchema2(
|
|
|
854
854
|
);
|
|
855
855
|
|
|
856
856
|
// src/anthropic-messages-options.ts
|
|
857
|
+
import {
|
|
858
|
+
lazySchema as lazySchema3,
|
|
859
|
+
zodSchema as zodSchema3
|
|
860
|
+
} from "@ai-sdk/provider-utils";
|
|
857
861
|
import { z as z3 } from "zod/v4";
|
|
858
|
-
var anthropicFilePartProviderOptions =
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
*/
|
|
867
|
-
enabled: z3.boolean()
|
|
868
|
-
}).optional(),
|
|
869
|
-
/**
|
|
870
|
-
* Custom title for the document.
|
|
871
|
-
* If not provided, the filename will be used.
|
|
872
|
-
*/
|
|
873
|
-
title: z3.string().optional(),
|
|
874
|
-
/**
|
|
875
|
-
* Context about the document that will be passed to the model
|
|
876
|
-
* but not used towards cited content.
|
|
877
|
-
* Useful for storing document metadata as text or stringified JSON.
|
|
878
|
-
*/
|
|
879
|
-
context: z3.string().optional()
|
|
880
|
-
});
|
|
881
|
-
var anthropicSystemMessageProviderOptions = z3.object({
|
|
882
|
-
/**
|
|
883
|
-
* Clears this mid-conversation system message after the current turn.
|
|
884
|
-
*
|
|
885
|
-
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
886
|
-
* which is added automatically.
|
|
887
|
-
*/
|
|
888
|
-
clearAt: z3.literal("next_user_message").optional(),
|
|
889
|
-
/**
|
|
890
|
-
* Sets the model effort from the next user turn until a later message
|
|
891
|
-
* changes it. An effort-only system message with empty content can appear
|
|
892
|
-
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
893
|
-
* added automatically.
|
|
894
|
-
*/
|
|
895
|
-
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
896
|
-
/**
|
|
897
|
-
* Mid-conversation tool changes. Adds or removes tools from the
|
|
898
|
-
* conversation's tool set between turns without invalidating the prompt
|
|
899
|
-
* cache.
|
|
900
|
-
*
|
|
901
|
-
* Only supported on system messages that appear mid-conversation (not the
|
|
902
|
-
* initial system prompt). A system message carrying tool changes must come
|
|
903
|
-
* right before an assistant message or at the end of the messages.
|
|
904
|
-
*
|
|
905
|
-
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
906
|
-
* option (typically with `deferLoading: true` so they are not loaded until
|
|
907
|
-
* the addition surfaces them). The required
|
|
908
|
-
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
909
|
-
*/
|
|
910
|
-
toolChanges: z3.array(
|
|
911
|
-
z3.discriminatedUnion("type", [
|
|
912
|
-
z3.object({
|
|
913
|
-
type: z3.literal("tool_addition"),
|
|
914
|
-
toolName: z3.string()
|
|
915
|
-
}),
|
|
916
|
-
z3.object({
|
|
917
|
-
type: z3.literal("tool_removal"),
|
|
918
|
-
toolName: z3.string()
|
|
919
|
-
})
|
|
920
|
-
])
|
|
921
|
-
).optional()
|
|
922
|
-
});
|
|
923
|
-
var anthropicThinkingBlockBinding = z3.object({
|
|
924
|
-
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
925
|
-
});
|
|
926
|
-
var anthropicLanguageModelOptions = z3.object({
|
|
927
|
-
/**
|
|
928
|
-
* Whether to send reasoning to the model.
|
|
929
|
-
*
|
|
930
|
-
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
931
|
-
*/
|
|
932
|
-
sendReasoning: z3.boolean().optional(),
|
|
933
|
-
/**
|
|
934
|
-
* Determines how structured outputs are generated.
|
|
935
|
-
*
|
|
936
|
-
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
937
|
-
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
938
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
939
|
-
*/
|
|
940
|
-
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
941
|
-
/**
|
|
942
|
-
* Configuration for enabling Claude's extended thinking.
|
|
943
|
-
*
|
|
944
|
-
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
945
|
-
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
946
|
-
*
|
|
947
|
-
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
948
|
-
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
949
|
-
* provider drops the unsupported setting, emits a warning, and sends an
|
|
950
|
-
* adaptive thinking request. Use `effort` to control how much they think.
|
|
951
|
-
*
|
|
952
|
-
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
953
|
-
* and the provider uses it in place of `disabled` for that model.
|
|
954
|
-
*/
|
|
955
|
-
thinking: z3.union([
|
|
956
|
-
z3.discriminatedUnion("type", [
|
|
957
|
-
z3.object({
|
|
958
|
-
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
959
|
-
type: z3.literal("adaptive"),
|
|
960
|
-
/**
|
|
961
|
-
* Controls whether thinking content is included in the response.
|
|
962
|
-
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
963
|
-
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
964
|
-
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
965
|
-
*/
|
|
966
|
-
display: z3.enum(["omitted", "summarized", "updates"]).optional(),
|
|
967
|
-
/**
|
|
968
|
-
* Controls how thinking blocks are bound to an assistant prefix.
|
|
969
|
-
*
|
|
970
|
-
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
971
|
-
* which is added automatically.
|
|
972
|
-
*/
|
|
973
|
-
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
974
|
-
}),
|
|
975
|
-
z3.object({
|
|
976
|
-
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
977
|
-
type: z3.literal("enabled"),
|
|
978
|
-
budgetTokens: z3.number().optional()
|
|
979
|
-
}),
|
|
980
|
-
z3.object({
|
|
981
|
-
type: z3.literal("disabled")
|
|
982
|
-
}),
|
|
983
|
-
z3.object({
|
|
862
|
+
var anthropicFilePartProviderOptions = lazySchema3(
|
|
863
|
+
() => zodSchema3(
|
|
864
|
+
z3.object({
|
|
865
|
+
/**
|
|
866
|
+
* Citation configuration for this document.
|
|
867
|
+
* When enabled, this document will generate citations in the response.
|
|
868
|
+
*/
|
|
869
|
+
citations: z3.object({
|
|
984
870
|
/**
|
|
985
|
-
*
|
|
986
|
-
* between tool calls are returned as summarized thinking blocks.
|
|
987
|
-
* Only supported at `low`, `medium`, and `high` effort.
|
|
871
|
+
* Enable citations for this document
|
|
988
872
|
*/
|
|
989
|
-
|
|
990
|
-
})
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
873
|
+
enabled: z3.boolean()
|
|
874
|
+
}).optional(),
|
|
875
|
+
/**
|
|
876
|
+
* Custom title for the document.
|
|
877
|
+
* If not provided, the filename will be used.
|
|
878
|
+
*/
|
|
879
|
+
title: z3.string().optional(),
|
|
880
|
+
/**
|
|
881
|
+
* Context about the document that will be passed to the model
|
|
882
|
+
* but not used towards cited content.
|
|
883
|
+
* Useful for storing document metadata as text or stringified JSON.
|
|
884
|
+
*/
|
|
885
|
+
context: z3.string().optional()
|
|
998
886
|
})
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
*/
|
|
1004
|
-
disableParallelToolUse: z3.boolean().optional(),
|
|
1005
|
-
/**
|
|
1006
|
-
* Cache control settings for this message.
|
|
1007
|
-
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1008
|
-
*/
|
|
1009
|
-
cacheControl: z3.object({
|
|
1010
|
-
type: z3.literal("ephemeral"),
|
|
1011
|
-
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
1012
|
-
}).optional(),
|
|
1013
|
-
/**
|
|
1014
|
-
* Metadata to include with the request.
|
|
1015
|
-
*
|
|
1016
|
-
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1017
|
-
*/
|
|
1018
|
-
metadata: z3.object({
|
|
1019
|
-
/**
|
|
1020
|
-
* An external identifier for the user associated with the request.
|
|
1021
|
-
*
|
|
1022
|
-
* Should be a UUID, hash value, or other opaque identifier.
|
|
1023
|
-
* Must not contain PII (name, email, phone number, etc.).
|
|
1024
|
-
*/
|
|
1025
|
-
userId: z3.string().optional()
|
|
1026
|
-
}).optional(),
|
|
1027
|
-
/**
|
|
1028
|
-
* MCP servers to be utilized in this request.
|
|
1029
|
-
*/
|
|
1030
|
-
mcpServers: z3.array(
|
|
887
|
+
)
|
|
888
|
+
);
|
|
889
|
+
var anthropicSystemMessageProviderOptions = lazySchema3(
|
|
890
|
+
() => zodSchema3(
|
|
1031
891
|
z3.object({
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
892
|
+
/**
|
|
893
|
+
* Clears this mid-conversation system message after the current turn.
|
|
894
|
+
*
|
|
895
|
+
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
896
|
+
* which is added automatically.
|
|
897
|
+
*/
|
|
898
|
+
clearAt: z3.literal("next_user_message").optional(),
|
|
899
|
+
/**
|
|
900
|
+
* Sets the model effort from the next user turn until a later message
|
|
901
|
+
* changes it. An effort-only system message with empty content can appear
|
|
902
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
903
|
+
* added automatically.
|
|
904
|
+
*/
|
|
905
|
+
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
906
|
+
/**
|
|
907
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
908
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
909
|
+
* cache.
|
|
910
|
+
*
|
|
911
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
912
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
913
|
+
* right before an assistant message or at the end of the messages.
|
|
914
|
+
*
|
|
915
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
916
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
917
|
+
* the addition surfaces them). The required
|
|
918
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
919
|
+
*/
|
|
920
|
+
toolChanges: z3.array(
|
|
921
|
+
z3.discriminatedUnion("type", [
|
|
922
|
+
z3.object({
|
|
923
|
+
type: z3.literal("tool_addition"),
|
|
924
|
+
toolName: z3.string()
|
|
925
|
+
}),
|
|
926
|
+
z3.object({
|
|
927
|
+
type: z3.literal("tool_removal"),
|
|
928
|
+
toolName: z3.string()
|
|
929
|
+
})
|
|
930
|
+
])
|
|
931
|
+
).optional()
|
|
1040
932
|
})
|
|
1041
|
-
)
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
id: z3.string().optional(),
|
|
1049
|
-
skills: z3.array(
|
|
1050
|
-
z3.object({
|
|
1051
|
-
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
1052
|
-
skillId: z3.string(),
|
|
1053
|
-
version: z3.string().optional()
|
|
1054
|
-
})
|
|
1055
|
-
).optional()
|
|
1056
|
-
}).optional(),
|
|
1057
|
-
/**
|
|
1058
|
-
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1059
|
-
* and structured outputs for every function tool in the request. When
|
|
1060
|
-
* true (the default), each function tool receives a default of
|
|
1061
|
-
* `eager_input_streaming: true` unless it explicitly sets
|
|
1062
|
-
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1063
|
-
*
|
|
1064
|
-
* @default true
|
|
1065
|
-
*/
|
|
1066
|
-
toolStreaming: z3.boolean().optional(),
|
|
1067
|
-
/**
|
|
1068
|
-
* Controls how much effort the model spends on thinking, text responses,
|
|
1069
|
-
* and tool calls. On models that always use adaptive thinking
|
|
1070
|
-
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1071
|
-
*
|
|
1072
|
-
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1073
|
-
*/
|
|
1074
|
-
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1075
|
-
/**
|
|
1076
|
-
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1077
|
-
* available for the current task, allowing it to prioritize work and wind down
|
|
1078
|
-
* gracefully as the budget is consumed.
|
|
1079
|
-
*
|
|
1080
|
-
* Advisory only — does not enforce a hard token limit.
|
|
1081
|
-
*/
|
|
1082
|
-
taskBudget: z3.object({
|
|
1083
|
-
type: z3.literal("tokens"),
|
|
1084
|
-
total: z3.number().int().min(2e4),
|
|
1085
|
-
remaining: z3.number().int().min(0).optional()
|
|
1086
|
-
}).optional(),
|
|
1087
|
-
/**
|
|
1088
|
-
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1089
|
-
* Only supported with claude-opus-4-6.
|
|
1090
|
-
*/
|
|
1091
|
-
speed: z3.enum(["fast", "standard"]).optional(),
|
|
1092
|
-
/**
|
|
1093
|
-
* Controls where model inference runs for this request.
|
|
1094
|
-
*
|
|
1095
|
-
* - `"global"`: Inference may run in any available geography (default).
|
|
1096
|
-
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1097
|
-
*
|
|
1098
|
-
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1099
|
-
*/
|
|
1100
|
-
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
1101
|
-
/**
|
|
1102
|
-
* Server-side fallback configuration.
|
|
1103
|
-
*
|
|
1104
|
-
* When the primary model's safety classifiers block a turn, the API
|
|
1105
|
-
* automatically retries it server-side on a fallback model. A
|
|
1106
|
-
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1107
|
-
*
|
|
1108
|
-
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1109
|
-
* recommended fallback model based on the refusal category. Requires the
|
|
1110
|
-
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1111
|
-
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1112
|
-
* request as a direct request to that entry's model, so it must be
|
|
1113
|
-
* formatted accordingly: `model` is required, and an entry may
|
|
1114
|
-
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1115
|
-
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1116
|
-
* beta). The value is passed through to the API as-is, and the
|
|
1117
|
-
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1118
|
-
*/
|
|
1119
|
-
fallbacks: z3.union([
|
|
1120
|
-
z3.literal("default"),
|
|
1121
|
-
z3.array(
|
|
1122
|
-
z3.object({
|
|
1123
|
-
model: z3.string(),
|
|
1124
|
-
max_tokens: z3.number().int().optional(),
|
|
1125
|
-
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1126
|
-
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1127
|
-
speed: z3.enum(["fast", "standard"]).optional()
|
|
1128
|
-
})
|
|
1129
|
-
)
|
|
1130
|
-
]).optional(),
|
|
1131
|
-
/**
|
|
1132
|
-
* A set of beta features to enable.
|
|
1133
|
-
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1134
|
-
*/
|
|
1135
|
-
anthropicBeta: z3.array(z3.string()).optional(),
|
|
1136
|
-
/**
|
|
1137
|
-
* Server-side safeguards to run as part of the request.
|
|
1138
|
-
*
|
|
1139
|
-
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1140
|
-
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1141
|
-
* relies on). The per-call verdicts are returned in
|
|
1142
|
-
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1143
|
-
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1144
|
-
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1145
|
-
*/
|
|
1146
|
-
safeguards: z3.array(
|
|
933
|
+
)
|
|
934
|
+
);
|
|
935
|
+
var anthropicLanguageModelOptions = lazySchema3(() => {
|
|
936
|
+
const anthropicThinkingBlockBinding = z3.object({
|
|
937
|
+
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
938
|
+
});
|
|
939
|
+
return zodSchema3(
|
|
1147
940
|
z3.object({
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
941
|
+
/**
|
|
942
|
+
* Whether to send reasoning to the model.
|
|
943
|
+
*
|
|
944
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
945
|
+
*/
|
|
946
|
+
sendReasoning: z3.boolean().optional(),
|
|
947
|
+
/**
|
|
948
|
+
* Determines how structured outputs are generated.
|
|
949
|
+
*
|
|
950
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
951
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
952
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
953
|
+
*/
|
|
954
|
+
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
955
|
+
/**
|
|
956
|
+
* Configuration for enabling Claude's extended thinking.
|
|
957
|
+
*
|
|
958
|
+
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
959
|
+
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
960
|
+
*
|
|
961
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
962
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
963
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
964
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
965
|
+
*
|
|
966
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
967
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
968
|
+
*/
|
|
969
|
+
thinking: z3.union([
|
|
970
|
+
z3.discriminatedUnion("type", [
|
|
971
|
+
z3.object({
|
|
972
|
+
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
973
|
+
type: z3.literal("adaptive"),
|
|
974
|
+
/**
|
|
975
|
+
* Controls whether thinking content is included in the response.
|
|
976
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
977
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
978
|
+
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
979
|
+
*/
|
|
980
|
+
display: z3.enum(["omitted", "summarized", "updates"]).optional(),
|
|
981
|
+
/**
|
|
982
|
+
* Controls how thinking blocks are bound to an assistant prefix.
|
|
983
|
+
*
|
|
984
|
+
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
985
|
+
* which is added automatically.
|
|
986
|
+
*/
|
|
987
|
+
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
988
|
+
}),
|
|
989
|
+
z3.object({
|
|
990
|
+
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
991
|
+
type: z3.literal("enabled"),
|
|
992
|
+
budgetTokens: z3.number().optional()
|
|
993
|
+
}),
|
|
994
|
+
z3.object({
|
|
995
|
+
type: z3.literal("disabled")
|
|
996
|
+
}),
|
|
997
|
+
z3.object({
|
|
998
|
+
/**
|
|
999
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1000
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1001
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1002
|
+
*/
|
|
1003
|
+
type: z3.literal("between_tools")
|
|
1004
|
+
})
|
|
1005
|
+
]),
|
|
1006
|
+
/**
|
|
1007
|
+
* Configures prefix mismatch recovery without changing the model's
|
|
1008
|
+
* default thinking mode.
|
|
1009
|
+
*/
|
|
1010
|
+
z3.object({
|
|
1011
|
+
blockBinding: anthropicThinkingBlockBinding
|
|
1012
|
+
})
|
|
1013
|
+
]).optional(),
|
|
1014
|
+
/**
|
|
1015
|
+
* Whether to disable parallel function calling during tool use. Default is false.
|
|
1016
|
+
* When set to true, Claude will use at most one tool per response.
|
|
1017
|
+
*/
|
|
1018
|
+
disableParallelToolUse: z3.boolean().optional(),
|
|
1019
|
+
/**
|
|
1020
|
+
* Cache control settings for this message.
|
|
1021
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1022
|
+
*/
|
|
1023
|
+
cacheControl: z3.object({
|
|
1024
|
+
type: z3.literal("ephemeral"),
|
|
1025
|
+
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
1026
|
+
}).optional(),
|
|
1027
|
+
/**
|
|
1028
|
+
* Metadata to include with the request.
|
|
1029
|
+
*
|
|
1030
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1031
|
+
*/
|
|
1032
|
+
metadata: z3.object({
|
|
1033
|
+
/**
|
|
1034
|
+
* An external identifier for the user associated with the request.
|
|
1035
|
+
*
|
|
1036
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
1037
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
1038
|
+
*/
|
|
1039
|
+
userId: z3.string().optional()
|
|
1040
|
+
}).optional(),
|
|
1041
|
+
/**
|
|
1042
|
+
* MCP servers to be utilized in this request.
|
|
1043
|
+
*/
|
|
1044
|
+
mcpServers: z3.array(
|
|
1155
1045
|
z3.object({
|
|
1156
|
-
type: z3.literal("
|
|
1157
|
-
|
|
1046
|
+
type: z3.literal("url"),
|
|
1047
|
+
name: z3.string(),
|
|
1048
|
+
url: z3.string(),
|
|
1049
|
+
authorizationToken: z3.string().nullish(),
|
|
1050
|
+
toolConfiguration: z3.object({
|
|
1051
|
+
enabled: z3.boolean().nullish(),
|
|
1052
|
+
allowedTools: z3.array(z3.string()).nullish()
|
|
1053
|
+
}).nullish()
|
|
1054
|
+
})
|
|
1055
|
+
).optional(),
|
|
1056
|
+
/**
|
|
1057
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
1058
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
1059
|
+
* Requires code execution tool to be enabled.
|
|
1060
|
+
*/
|
|
1061
|
+
container: z3.object({
|
|
1062
|
+
id: z3.string().optional(),
|
|
1063
|
+
skills: z3.array(
|
|
1064
|
+
z3.object({
|
|
1065
|
+
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
1066
|
+
skillId: z3.string(),
|
|
1067
|
+
version: z3.string().optional()
|
|
1068
|
+
})
|
|
1069
|
+
).optional()
|
|
1070
|
+
}).optional(),
|
|
1071
|
+
/**
|
|
1072
|
+
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1073
|
+
* and structured outputs for every function tool in the request. When
|
|
1074
|
+
* true (the default), each function tool receives a default of
|
|
1075
|
+
* `eager_input_streaming: true` unless it explicitly sets
|
|
1076
|
+
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1077
|
+
*
|
|
1078
|
+
* @default true
|
|
1079
|
+
*/
|
|
1080
|
+
toolStreaming: z3.boolean().optional(),
|
|
1081
|
+
/**
|
|
1082
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1083
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1084
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1085
|
+
*
|
|
1086
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1087
|
+
*/
|
|
1088
|
+
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1089
|
+
/**
|
|
1090
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1091
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
1092
|
+
* gracefully as the budget is consumed.
|
|
1093
|
+
*
|
|
1094
|
+
* Advisory only — does not enforce a hard token limit.
|
|
1095
|
+
*/
|
|
1096
|
+
taskBudget: z3.object({
|
|
1097
|
+
type: z3.literal("tokens"),
|
|
1098
|
+
total: z3.number().int().min(2e4),
|
|
1099
|
+
remaining: z3.number().int().min(0).optional()
|
|
1100
|
+
}).optional(),
|
|
1101
|
+
/**
|
|
1102
|
+
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1103
|
+
* Only supported with claude-opus-4-6.
|
|
1104
|
+
*/
|
|
1105
|
+
speed: z3.enum(["fast", "standard"]).optional(),
|
|
1106
|
+
/**
|
|
1107
|
+
* Controls where model inference runs for this request.
|
|
1108
|
+
*
|
|
1109
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
1110
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1111
|
+
*
|
|
1112
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1113
|
+
*/
|
|
1114
|
+
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
1115
|
+
/**
|
|
1116
|
+
* Server-side fallback configuration.
|
|
1117
|
+
*
|
|
1118
|
+
* When the primary model's safety classifiers block a turn, the API
|
|
1119
|
+
* automatically retries it server-side on a fallback model. A
|
|
1120
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1121
|
+
*
|
|
1122
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1123
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
1124
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1125
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1126
|
+
* request as a direct request to that entry's model, so it must be
|
|
1127
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
1128
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1129
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1130
|
+
* beta). The value is passed through to the API as-is, and the
|
|
1131
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1132
|
+
*/
|
|
1133
|
+
fallbacks: z3.union([
|
|
1134
|
+
z3.literal("default"),
|
|
1135
|
+
z3.array(
|
|
1136
|
+
z3.object({
|
|
1137
|
+
model: z3.string(),
|
|
1138
|
+
max_tokens: z3.number().int().optional(),
|
|
1139
|
+
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1140
|
+
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1141
|
+
speed: z3.enum(["fast", "standard"]).optional()
|
|
1142
|
+
})
|
|
1143
|
+
)
|
|
1144
|
+
]).optional(),
|
|
1145
|
+
/**
|
|
1146
|
+
* A set of beta features to enable.
|
|
1147
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1148
|
+
*/
|
|
1149
|
+
anthropicBeta: z3.array(z3.string()).optional(),
|
|
1150
|
+
/**
|
|
1151
|
+
* Server-side safeguards to run as part of the request.
|
|
1152
|
+
*
|
|
1153
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1154
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1155
|
+
* relies on). The per-call verdicts are returned in
|
|
1156
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1157
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1158
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1159
|
+
*/
|
|
1160
|
+
safeguards: z3.array(
|
|
1161
|
+
z3.object({
|
|
1162
|
+
type: z3.literal("dangerous_tool_use"),
|
|
1163
|
+
classifierContext: z3.record(z3.string(), z3.unknown()).optional()
|
|
1164
|
+
})
|
|
1165
|
+
).optional(),
|
|
1166
|
+
contextManagement: z3.object({
|
|
1167
|
+
edits: z3.array(
|
|
1168
|
+
z3.discriminatedUnion("type", [
|
|
1158
1169
|
z3.object({
|
|
1159
|
-
type: z3.literal("
|
|
1160
|
-
|
|
1170
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
1171
|
+
trigger: z3.discriminatedUnion("type", [
|
|
1172
|
+
z3.object({
|
|
1173
|
+
type: z3.literal("input_tokens"),
|
|
1174
|
+
value: z3.number()
|
|
1175
|
+
}),
|
|
1176
|
+
z3.object({
|
|
1177
|
+
type: z3.literal("tool_uses"),
|
|
1178
|
+
value: z3.number()
|
|
1179
|
+
})
|
|
1180
|
+
]).optional(),
|
|
1181
|
+
keep: z3.object({
|
|
1182
|
+
type: z3.literal("tool_uses"),
|
|
1183
|
+
value: z3.number()
|
|
1184
|
+
}).optional(),
|
|
1185
|
+
clearAtLeast: z3.object({
|
|
1186
|
+
type: z3.literal("input_tokens"),
|
|
1187
|
+
value: z3.number()
|
|
1188
|
+
}).optional(),
|
|
1189
|
+
clearToolInputs: z3.boolean().optional(),
|
|
1190
|
+
excludeTools: z3.array(z3.string()).optional()
|
|
1161
1191
|
}),
|
|
1162
1192
|
z3.object({
|
|
1163
|
-
type: z3.literal("
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
type: z3.literal("input_tokens"),
|
|
1173
|
-
value: z3.number()
|
|
1174
|
-
}).optional(),
|
|
1175
|
-
clearToolInputs: z3.boolean().optional(),
|
|
1176
|
-
excludeTools: z3.array(z3.string()).optional()
|
|
1177
|
-
}),
|
|
1178
|
-
z3.object({
|
|
1179
|
-
type: z3.literal("clear_thinking_20251015"),
|
|
1180
|
-
keep: z3.union([
|
|
1181
|
-
z3.literal("all"),
|
|
1193
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
1194
|
+
keep: z3.union([
|
|
1195
|
+
z3.literal("all"),
|
|
1196
|
+
z3.object({
|
|
1197
|
+
type: z3.literal("thinking_turns"),
|
|
1198
|
+
value: z3.number()
|
|
1199
|
+
})
|
|
1200
|
+
]).optional()
|
|
1201
|
+
}),
|
|
1182
1202
|
z3.object({
|
|
1183
|
-
type: z3.literal("
|
|
1184
|
-
|
|
1203
|
+
type: z3.literal("compact_20260112"),
|
|
1204
|
+
trigger: z3.object({
|
|
1205
|
+
type: z3.literal("input_tokens"),
|
|
1206
|
+
value: z3.number()
|
|
1207
|
+
}).optional(),
|
|
1208
|
+
pauseAfterCompaction: z3.boolean().optional(),
|
|
1209
|
+
instructions: z3.string().optional()
|
|
1185
1210
|
})
|
|
1186
|
-
])
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
type: z3.literal("input_tokens"),
|
|
1192
|
-
value: z3.number()
|
|
1193
|
-
}).optional(),
|
|
1194
|
-
pauseAfterCompaction: z3.boolean().optional(),
|
|
1195
|
-
instructions: z3.string().optional()
|
|
1196
|
-
})
|
|
1197
|
-
])
|
|
1198
|
-
)
|
|
1199
|
-
}).optional()
|
|
1211
|
+
])
|
|
1212
|
+
)
|
|
1213
|
+
}).optional()
|
|
1214
|
+
})
|
|
1215
|
+
);
|
|
1200
1216
|
});
|
|
1201
1217
|
|
|
1202
1218
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1206,19 +1222,24 @@ import {
|
|
|
1206
1222
|
|
|
1207
1223
|
// src/get-cache-control.ts
|
|
1208
1224
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
1209
|
-
function getCacheControl(providerMetadata) {
|
|
1210
|
-
var _a;
|
|
1225
|
+
function getCacheControl(providerMetadata, providerOptionsName) {
|
|
1226
|
+
var _a, _b, _c;
|
|
1227
|
+
const custom = providerMetadata == null ? void 0 : providerMetadata[providerOptionsName];
|
|
1211
1228
|
const anthropic = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
1212
|
-
const cacheControlValue = (_a = anthropic == null ? void 0 : anthropic.cacheControl) != null ?
|
|
1229
|
+
const cacheControlValue = (_c = (_b = (_a = custom == null ? void 0 : custom.cacheControl) != null ? _a : custom == null ? void 0 : custom.cache_control) != null ? _b : anthropic == null ? void 0 : anthropic.cacheControl) != null ? _c : anthropic == null ? void 0 : anthropic.cache_control;
|
|
1213
1230
|
return cacheControlValue;
|
|
1214
1231
|
}
|
|
1215
1232
|
var CacheControlValidator = class {
|
|
1216
|
-
constructor() {
|
|
1233
|
+
constructor(providerOptionsName = "anthropic") {
|
|
1234
|
+
this.providerOptionsName = providerOptionsName;
|
|
1217
1235
|
this.breakpointCount = 0;
|
|
1218
1236
|
this.warnings = [];
|
|
1219
1237
|
}
|
|
1220
1238
|
getCacheControl(providerMetadata, context) {
|
|
1221
|
-
const cacheControlValue = getCacheControl(
|
|
1239
|
+
const cacheControlValue = getCacheControl(
|
|
1240
|
+
providerMetadata,
|
|
1241
|
+
this.providerOptionsName
|
|
1242
|
+
);
|
|
1222
1243
|
if (!cacheControlValue) {
|
|
1223
1244
|
return void 0;
|
|
1224
1245
|
}
|
|
@@ -1249,12 +1270,12 @@ var CacheControlValidator = class {
|
|
|
1249
1270
|
// src/tool/advisor_20260301.ts
|
|
1250
1271
|
import {
|
|
1251
1272
|
createProviderToolFactoryWithOutputSchema,
|
|
1252
|
-
lazySchema as
|
|
1253
|
-
zodSchema as
|
|
1273
|
+
lazySchema as lazySchema4,
|
|
1274
|
+
zodSchema as zodSchema4
|
|
1254
1275
|
} from "@ai-sdk/provider-utils";
|
|
1255
1276
|
import { z as z4 } from "zod/v4";
|
|
1256
|
-
var advisor_20260301ArgsSchema =
|
|
1257
|
-
() =>
|
|
1277
|
+
var advisor_20260301ArgsSchema = lazySchema4(
|
|
1278
|
+
() => zodSchema4(
|
|
1258
1279
|
z4.object({
|
|
1259
1280
|
model: z4.string(),
|
|
1260
1281
|
maxUses: z4.number().optional(),
|
|
@@ -1265,8 +1286,8 @@ var advisor_20260301ArgsSchema = lazySchema3(
|
|
|
1265
1286
|
})
|
|
1266
1287
|
)
|
|
1267
1288
|
);
|
|
1268
|
-
var advisor_20260301OutputSchema =
|
|
1269
|
-
() =>
|
|
1289
|
+
var advisor_20260301OutputSchema = lazySchema4(
|
|
1290
|
+
() => zodSchema4(
|
|
1270
1291
|
z4.discriminatedUnion("type", [
|
|
1271
1292
|
z4.object({
|
|
1272
1293
|
type: z4.literal("advisor_result"),
|
|
@@ -1283,8 +1304,8 @@ var advisor_20260301OutputSchema = lazySchema3(
|
|
|
1283
1304
|
])
|
|
1284
1305
|
)
|
|
1285
1306
|
);
|
|
1286
|
-
var advisor_20260301InputSchema =
|
|
1287
|
-
() =>
|
|
1307
|
+
var advisor_20260301InputSchema = lazySchema4(
|
|
1308
|
+
() => zodSchema4(z4.object({}).strict())
|
|
1288
1309
|
);
|
|
1289
1310
|
var factory = createProviderToolFactoryWithOutputSchema({
|
|
1290
1311
|
id: "anthropic.advisor_20260301",
|
|
@@ -1299,8 +1320,8 @@ var advisor_20260301 = (args) => {
|
|
|
1299
1320
|
// src/tool/computer-toolset_20260801.ts
|
|
1300
1321
|
import {
|
|
1301
1322
|
createProviderToolFactory,
|
|
1302
|
-
lazySchema as
|
|
1303
|
-
zodSchema as
|
|
1323
|
+
lazySchema as lazySchema5,
|
|
1324
|
+
zodSchema as zodSchema5
|
|
1304
1325
|
} from "@ai-sdk/provider-utils";
|
|
1305
1326
|
import { z as z5 } from "zod/v4";
|
|
1306
1327
|
var computerToolset_20260801Members = [
|
|
@@ -1322,8 +1343,8 @@ var computerToolset_20260801Members = [
|
|
|
1322
1343
|
"hold_key",
|
|
1323
1344
|
"wait"
|
|
1324
1345
|
];
|
|
1325
|
-
var computerToolset_20260801InputSchema =
|
|
1326
|
-
() =>
|
|
1346
|
+
var computerToolset_20260801InputSchema = lazySchema5(
|
|
1347
|
+
() => zodSchema5(
|
|
1327
1348
|
z5.object({
|
|
1328
1349
|
action: z5.enum(computerToolset_20260801Members),
|
|
1329
1350
|
coordinate: z5.tuple([z5.number().int(), z5.number().int()]).optional(),
|
|
@@ -1342,8 +1363,8 @@ var computerToolset_20260801InputSchema = lazySchema4(
|
|
|
1342
1363
|
})
|
|
1343
1364
|
)
|
|
1344
1365
|
);
|
|
1345
|
-
var computerToolset_20260801ArgsSchema =
|
|
1346
|
-
() =>
|
|
1366
|
+
var computerToolset_20260801ArgsSchema = lazySchema5(
|
|
1367
|
+
() => zodSchema5(
|
|
1347
1368
|
z5.object({
|
|
1348
1369
|
configs: z5.partialRecord(
|
|
1349
1370
|
z5.enum(computerToolset_20260801Members),
|
|
@@ -1363,19 +1384,19 @@ var computerToolset_20260801 = createProviderToolFactory({
|
|
|
1363
1384
|
// src/tool/text-editor_20250728.ts
|
|
1364
1385
|
import {
|
|
1365
1386
|
createProviderToolFactory as createProviderToolFactory2,
|
|
1366
|
-
lazySchema as
|
|
1367
|
-
zodSchema as
|
|
1387
|
+
lazySchema as lazySchema6,
|
|
1388
|
+
zodSchema as zodSchema6
|
|
1368
1389
|
} from "@ai-sdk/provider-utils";
|
|
1369
1390
|
import { z as z6 } from "zod/v4";
|
|
1370
|
-
var textEditor_20250728ArgsSchema =
|
|
1371
|
-
() =>
|
|
1391
|
+
var textEditor_20250728ArgsSchema = lazySchema6(
|
|
1392
|
+
() => zodSchema6(
|
|
1372
1393
|
z6.object({
|
|
1373
1394
|
maxCharacters: z6.number().optional()
|
|
1374
1395
|
})
|
|
1375
1396
|
)
|
|
1376
1397
|
);
|
|
1377
|
-
var textEditor_20250728InputSchema =
|
|
1378
|
-
() =>
|
|
1398
|
+
var textEditor_20250728InputSchema = lazySchema6(
|
|
1399
|
+
() => zodSchema6(
|
|
1379
1400
|
z6.object({
|
|
1380
1401
|
command: z6.enum(["view", "create", "str_replace", "insert"]),
|
|
1381
1402
|
path: z6.string(),
|
|
@@ -1399,12 +1420,12 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1399
1420
|
// src/tool/web-search_20260209.ts
|
|
1400
1421
|
import {
|
|
1401
1422
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1402
|
-
lazySchema as
|
|
1403
|
-
zodSchema as
|
|
1423
|
+
lazySchema as lazySchema7,
|
|
1424
|
+
zodSchema as zodSchema7
|
|
1404
1425
|
} from "@ai-sdk/provider-utils";
|
|
1405
1426
|
import { z as z7 } from "zod/v4";
|
|
1406
|
-
var webSearch_20260209ArgsSchema =
|
|
1407
|
-
() =>
|
|
1427
|
+
var webSearch_20260209ArgsSchema = lazySchema7(
|
|
1428
|
+
() => zodSchema7(
|
|
1408
1429
|
z7.object({
|
|
1409
1430
|
maxUses: z7.number().optional(),
|
|
1410
1431
|
allowedDomains: z7.array(z7.string()).optional(),
|
|
@@ -1419,8 +1440,8 @@ var webSearch_20260209ArgsSchema = lazySchema6(
|
|
|
1419
1440
|
})
|
|
1420
1441
|
)
|
|
1421
1442
|
);
|
|
1422
|
-
var webSearch_20260209OutputSchema =
|
|
1423
|
-
() =>
|
|
1443
|
+
var webSearch_20260209OutputSchema = lazySchema7(
|
|
1444
|
+
() => zodSchema7(
|
|
1424
1445
|
z7.array(
|
|
1425
1446
|
z7.object({
|
|
1426
1447
|
url: z7.string(),
|
|
@@ -1432,8 +1453,8 @@ var webSearch_20260209OutputSchema = lazySchema6(
|
|
|
1432
1453
|
)
|
|
1433
1454
|
)
|
|
1434
1455
|
);
|
|
1435
|
-
var webSearch_20260209InputSchema =
|
|
1436
|
-
() =>
|
|
1456
|
+
var webSearch_20260209InputSchema = lazySchema7(
|
|
1457
|
+
() => zodSchema7(
|
|
1437
1458
|
z7.object({
|
|
1438
1459
|
query: z7.string()
|
|
1439
1460
|
})
|
|
@@ -1452,12 +1473,12 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1452
1473
|
// src/tool/web-search_20250305.ts
|
|
1453
1474
|
import {
|
|
1454
1475
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1455
|
-
lazySchema as
|
|
1456
|
-
zodSchema as
|
|
1476
|
+
lazySchema as lazySchema8,
|
|
1477
|
+
zodSchema as zodSchema8
|
|
1457
1478
|
} from "@ai-sdk/provider-utils";
|
|
1458
1479
|
import { z as z8 } from "zod/v4";
|
|
1459
|
-
var webSearch_20250305ArgsSchema =
|
|
1460
|
-
() =>
|
|
1480
|
+
var webSearch_20250305ArgsSchema = lazySchema8(
|
|
1481
|
+
() => zodSchema8(
|
|
1461
1482
|
z8.object({
|
|
1462
1483
|
maxUses: z8.number().optional(),
|
|
1463
1484
|
allowedDomains: z8.array(z8.string()).optional(),
|
|
@@ -1472,8 +1493,8 @@ var webSearch_20250305ArgsSchema = lazySchema7(
|
|
|
1472
1493
|
})
|
|
1473
1494
|
)
|
|
1474
1495
|
);
|
|
1475
|
-
var webSearch_20250305OutputSchema =
|
|
1476
|
-
() =>
|
|
1496
|
+
var webSearch_20250305OutputSchema = lazySchema8(
|
|
1497
|
+
() => zodSchema8(
|
|
1477
1498
|
z8.array(
|
|
1478
1499
|
z8.object({
|
|
1479
1500
|
url: z8.string(),
|
|
@@ -1485,8 +1506,8 @@ var webSearch_20250305OutputSchema = lazySchema7(
|
|
|
1485
1506
|
)
|
|
1486
1507
|
)
|
|
1487
1508
|
);
|
|
1488
|
-
var webSearch_20250305InputSchema =
|
|
1489
|
-
() =>
|
|
1509
|
+
var webSearch_20250305InputSchema = lazySchema8(
|
|
1510
|
+
() => zodSchema8(
|
|
1490
1511
|
z8.object({
|
|
1491
1512
|
query: z8.string()
|
|
1492
1513
|
})
|
|
@@ -1505,12 +1526,12 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1505
1526
|
// src/tool/web-fetch-20260209.ts
|
|
1506
1527
|
import {
|
|
1507
1528
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1508
|
-
lazySchema as
|
|
1509
|
-
zodSchema as
|
|
1529
|
+
lazySchema as lazySchema9,
|
|
1530
|
+
zodSchema as zodSchema9
|
|
1510
1531
|
} from "@ai-sdk/provider-utils";
|
|
1511
1532
|
import { z as z9 } from "zod/v4";
|
|
1512
|
-
var webFetch_20260209ArgsSchema =
|
|
1513
|
-
() =>
|
|
1533
|
+
var webFetch_20260209ArgsSchema = lazySchema9(
|
|
1534
|
+
() => zodSchema9(
|
|
1514
1535
|
z9.object({
|
|
1515
1536
|
maxUses: z9.number().optional(),
|
|
1516
1537
|
allowedDomains: z9.array(z9.string()).optional(),
|
|
@@ -1520,8 +1541,8 @@ var webFetch_20260209ArgsSchema = lazySchema8(
|
|
|
1520
1541
|
})
|
|
1521
1542
|
)
|
|
1522
1543
|
);
|
|
1523
|
-
var webFetch_20260209OutputSchema =
|
|
1524
|
-
() =>
|
|
1544
|
+
var webFetch_20260209OutputSchema = lazySchema9(
|
|
1545
|
+
() => zodSchema9(
|
|
1525
1546
|
z9.object({
|
|
1526
1547
|
type: z9.literal("web_fetch_result"),
|
|
1527
1548
|
url: z9.string(),
|
|
@@ -1546,8 +1567,8 @@ var webFetch_20260209OutputSchema = lazySchema8(
|
|
|
1546
1567
|
})
|
|
1547
1568
|
)
|
|
1548
1569
|
);
|
|
1549
|
-
var webFetch_20260209InputSchema =
|
|
1550
|
-
() =>
|
|
1570
|
+
var webFetch_20260209InputSchema = lazySchema9(
|
|
1571
|
+
() => zodSchema9(
|
|
1551
1572
|
z9.object({
|
|
1552
1573
|
url: z9.string()
|
|
1553
1574
|
})
|
|
@@ -1566,12 +1587,12 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1566
1587
|
// src/tool/web-fetch-20250910.ts
|
|
1567
1588
|
import {
|
|
1568
1589
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1569
|
-
lazySchema as
|
|
1570
|
-
zodSchema as
|
|
1590
|
+
lazySchema as lazySchema10,
|
|
1591
|
+
zodSchema as zodSchema10
|
|
1571
1592
|
} from "@ai-sdk/provider-utils";
|
|
1572
1593
|
import { z as z10 } from "zod/v4";
|
|
1573
|
-
var webFetch_20250910ArgsSchema =
|
|
1574
|
-
() =>
|
|
1594
|
+
var webFetch_20250910ArgsSchema = lazySchema10(
|
|
1595
|
+
() => zodSchema10(
|
|
1575
1596
|
z10.object({
|
|
1576
1597
|
maxUses: z10.number().optional(),
|
|
1577
1598
|
allowedDomains: z10.array(z10.string()).optional(),
|
|
@@ -1581,8 +1602,8 @@ var webFetch_20250910ArgsSchema = lazySchema9(
|
|
|
1581
1602
|
})
|
|
1582
1603
|
)
|
|
1583
1604
|
);
|
|
1584
|
-
var webFetch_20250910OutputSchema =
|
|
1585
|
-
() =>
|
|
1605
|
+
var webFetch_20250910OutputSchema = lazySchema10(
|
|
1606
|
+
() => zodSchema10(
|
|
1586
1607
|
z10.object({
|
|
1587
1608
|
type: z10.literal("web_fetch_result"),
|
|
1588
1609
|
url: z10.string(),
|
|
@@ -1607,8 +1628,8 @@ var webFetch_20250910OutputSchema = lazySchema9(
|
|
|
1607
1628
|
})
|
|
1608
1629
|
)
|
|
1609
1630
|
);
|
|
1610
|
-
var webFetch_20250910InputSchema =
|
|
1611
|
-
() =>
|
|
1631
|
+
var webFetch_20250910InputSchema = lazySchema10(
|
|
1632
|
+
() => zodSchema10(
|
|
1612
1633
|
z10.object({
|
|
1613
1634
|
url: z10.string()
|
|
1614
1635
|
})
|
|
@@ -2117,12 +2138,12 @@ import {
|
|
|
2117
2138
|
// src/tool/code-execution_20250522.ts
|
|
2118
2139
|
import {
|
|
2119
2140
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
2120
|
-
lazySchema as
|
|
2121
|
-
zodSchema as
|
|
2141
|
+
lazySchema as lazySchema11,
|
|
2142
|
+
zodSchema as zodSchema11
|
|
2122
2143
|
} from "@ai-sdk/provider-utils";
|
|
2123
2144
|
import { z as z11 } from "zod/v4";
|
|
2124
|
-
var codeExecution_20250522OutputSchema =
|
|
2125
|
-
() =>
|
|
2145
|
+
var codeExecution_20250522OutputSchema = lazySchema11(
|
|
2146
|
+
() => zodSchema11(
|
|
2126
2147
|
z11.object({
|
|
2127
2148
|
type: z11.literal("code_execution_result"),
|
|
2128
2149
|
stdout: z11.string(),
|
|
@@ -2137,8 +2158,8 @@ var codeExecution_20250522OutputSchema = lazySchema10(
|
|
|
2137
2158
|
})
|
|
2138
2159
|
)
|
|
2139
2160
|
);
|
|
2140
|
-
var codeExecution_20250522InputSchema =
|
|
2141
|
-
() =>
|
|
2161
|
+
var codeExecution_20250522InputSchema = lazySchema11(
|
|
2162
|
+
() => zodSchema11(
|
|
2142
2163
|
z11.object({
|
|
2143
2164
|
code: z11.string()
|
|
2144
2165
|
})
|
|
@@ -2156,12 +2177,12 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2156
2177
|
// src/tool/code-execution_20250825.ts
|
|
2157
2178
|
import {
|
|
2158
2179
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
2159
|
-
lazySchema as
|
|
2160
|
-
zodSchema as
|
|
2180
|
+
lazySchema as lazySchema12,
|
|
2181
|
+
zodSchema as zodSchema12
|
|
2161
2182
|
} from "@ai-sdk/provider-utils";
|
|
2162
2183
|
import { z as z12 } from "zod/v4";
|
|
2163
|
-
var codeExecution_20250825OutputSchema =
|
|
2164
|
-
() =>
|
|
2184
|
+
var codeExecution_20250825OutputSchema = lazySchema12(
|
|
2185
|
+
() => zodSchema12(
|
|
2165
2186
|
z12.discriminatedUnion("type", [
|
|
2166
2187
|
z12.object({
|
|
2167
2188
|
type: z12.literal("code_execution_result"),
|
|
@@ -2218,8 +2239,8 @@ var codeExecution_20250825OutputSchema = lazySchema11(
|
|
|
2218
2239
|
])
|
|
2219
2240
|
)
|
|
2220
2241
|
);
|
|
2221
|
-
var codeExecution_20250825InputSchema =
|
|
2222
|
-
() =>
|
|
2242
|
+
var codeExecution_20250825InputSchema = lazySchema12(
|
|
2243
|
+
() => zodSchema12(
|
|
2223
2244
|
z12.discriminatedUnion("type", [
|
|
2224
2245
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2225
2246
|
z12.object({
|
|
@@ -2269,12 +2290,12 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2269
2290
|
// src/tool/code-execution_20260120.ts
|
|
2270
2291
|
import {
|
|
2271
2292
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2272
|
-
lazySchema as
|
|
2273
|
-
zodSchema as
|
|
2293
|
+
lazySchema as lazySchema13,
|
|
2294
|
+
zodSchema as zodSchema13
|
|
2274
2295
|
} from "@ai-sdk/provider-utils";
|
|
2275
2296
|
import { z as z13 } from "zod/v4";
|
|
2276
|
-
var codeExecution_20260120OutputSchema =
|
|
2277
|
-
() =>
|
|
2297
|
+
var codeExecution_20260120OutputSchema = lazySchema13(
|
|
2298
|
+
() => zodSchema13(
|
|
2278
2299
|
z13.discriminatedUnion("type", [
|
|
2279
2300
|
z13.object({
|
|
2280
2301
|
type: z13.literal("code_execution_result"),
|
|
@@ -2343,8 +2364,8 @@ var codeExecution_20260120OutputSchema = lazySchema12(
|
|
|
2343
2364
|
])
|
|
2344
2365
|
)
|
|
2345
2366
|
);
|
|
2346
|
-
var codeExecution_20260120InputSchema =
|
|
2347
|
-
() =>
|
|
2367
|
+
var codeExecution_20260120InputSchema = lazySchema13(
|
|
2368
|
+
() => zodSchema13(
|
|
2348
2369
|
z13.discriminatedUnion("type", [
|
|
2349
2370
|
z13.object({
|
|
2350
2371
|
type: z13.literal("programmatic-tool-call"),
|
|
@@ -2390,12 +2411,12 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2390
2411
|
// src/tool/tool-search-regex_20251119.ts
|
|
2391
2412
|
import {
|
|
2392
2413
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2393
|
-
lazySchema as
|
|
2394
|
-
zodSchema as
|
|
2414
|
+
lazySchema as lazySchema14,
|
|
2415
|
+
zodSchema as zodSchema14
|
|
2395
2416
|
} from "@ai-sdk/provider-utils";
|
|
2396
2417
|
import { z as z14 } from "zod/v4";
|
|
2397
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
2398
|
-
() =>
|
|
2418
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema14(
|
|
2419
|
+
() => zodSchema14(
|
|
2399
2420
|
z14.array(
|
|
2400
2421
|
z14.object({
|
|
2401
2422
|
type: z14.literal("tool_reference"),
|
|
@@ -2404,8 +2425,8 @@ var toolSearchRegex_20251119OutputSchema = lazySchema13(
|
|
|
2404
2425
|
)
|
|
2405
2426
|
)
|
|
2406
2427
|
);
|
|
2407
|
-
var toolSearchRegex_20251119InputSchema =
|
|
2408
|
-
() =>
|
|
2428
|
+
var toolSearchRegex_20251119InputSchema = lazySchema14(
|
|
2429
|
+
() => zodSchema14(
|
|
2409
2430
|
z14.object({
|
|
2410
2431
|
/**
|
|
2411
2432
|
* A regex pattern to search for tools.
|
|
@@ -2482,7 +2503,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2482
2503
|
warnings,
|
|
2483
2504
|
cacheControlValidator,
|
|
2484
2505
|
toolNameMapping,
|
|
2485
|
-
toolsetNames = {}
|
|
2506
|
+
toolsetNames = {},
|
|
2507
|
+
convertMediaPart
|
|
2486
2508
|
}) {
|
|
2487
2509
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2488
2510
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2625,6 +2647,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2625
2647
|
break;
|
|
2626
2648
|
}
|
|
2627
2649
|
case "file": {
|
|
2650
|
+
const customContent = await (convertMediaPart == null ? void 0 : convertMediaPart(part));
|
|
2651
|
+
if (customContent != null) {
|
|
2652
|
+
anthropicContent.push({
|
|
2653
|
+
...customContent,
|
|
2654
|
+
cache_control: cacheControl
|
|
2655
|
+
});
|
|
2656
|
+
break;
|
|
2657
|
+
}
|
|
2628
2658
|
if (part.mediaType.startsWith("image/")) {
|
|
2629
2659
|
anthropicContent.push({
|
|
2630
2660
|
type: "image",
|
|
@@ -3821,7 +3851,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3821
3851
|
providerOptions,
|
|
3822
3852
|
stream
|
|
3823
3853
|
}) {
|
|
3824
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3854
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3825
3855
|
const warnings = [];
|
|
3826
3856
|
if (frequencyPenalty != null) {
|
|
3827
3857
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3832,18 +3862,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3832
3862
|
if (seed != null) {
|
|
3833
3863
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
3834
3864
|
}
|
|
3835
|
-
|
|
3865
|
+
const maxTemperature = (_a = this.config.maxTemperature) != null ? _a : 1;
|
|
3866
|
+
const temperatureProvider = this.config.maxTemperature == null ? "anthropic" : this.providerOptionsName;
|
|
3867
|
+
if (temperature != null && temperature > maxTemperature) {
|
|
3836
3868
|
warnings.push({
|
|
3837
3869
|
type: "unsupported",
|
|
3838
3870
|
feature: "temperature",
|
|
3839
|
-
details: `${temperature} exceeds
|
|
3871
|
+
details: `${temperature} exceeds ${temperatureProvider} maximum of ${maxTemperature.toFixed(1)}. clamped to ${maxTemperature.toFixed(1)}`
|
|
3840
3872
|
});
|
|
3841
|
-
temperature =
|
|
3873
|
+
temperature = maxTemperature;
|
|
3842
3874
|
} else if (temperature != null && temperature < 0) {
|
|
3843
3875
|
warnings.push({
|
|
3844
3876
|
type: "unsupported",
|
|
3845
3877
|
feature: "temperature",
|
|
3846
|
-
details: `${temperature} is below
|
|
3878
|
+
details: `${temperature} is below ${temperatureProvider} minimum of 0. clamped to 0`
|
|
3847
3879
|
});
|
|
3848
3880
|
temperature = 0;
|
|
3849
3881
|
}
|
|
@@ -3918,9 +3950,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3918
3950
|
}
|
|
3919
3951
|
}
|
|
3920
3952
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3921
|
-
const supportsStructuredOutput = ((
|
|
3922
|
-
const supportsStrictTools = ((
|
|
3923
|
-
const structureOutputMode = (
|
|
3953
|
+
const supportsStructuredOutput = ((_b = this.config.supportsNativeStructuredOutput) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3954
|
+
const supportsStrictTools = ((_c = this.config.supportsStrictTools) != null ? _c : true) && modelSupportsStructuredOutput;
|
|
3955
|
+
const structureOutputMode = (_d = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _d : "auto";
|
|
3924
3956
|
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3925
3957
|
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3926
3958
|
warnings.push({
|
|
@@ -3944,7 +3976,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3944
3976
|
});
|
|
3945
3977
|
}
|
|
3946
3978
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3947
|
-
const cacheControlValidator = new CacheControlValidator(
|
|
3979
|
+
const cacheControlValidator = new CacheControlValidator(
|
|
3980
|
+
this.config.cacheControlProviderOptionsName
|
|
3981
|
+
);
|
|
3948
3982
|
const toolNameMapping = createToolNameMapping({
|
|
3949
3983
|
tools,
|
|
3950
3984
|
providerToolNames: {
|
|
@@ -3974,11 +4008,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3974
4008
|
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3975
4009
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3976
4010
|
prompt,
|
|
3977
|
-
sendReasoning: (
|
|
4011
|
+
sendReasoning: (_e = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _e : true,
|
|
3978
4012
|
warnings,
|
|
3979
4013
|
cacheControlValidator,
|
|
3980
4014
|
toolNameMapping,
|
|
3981
|
-
toolsetNames
|
|
4015
|
+
toolsetNames,
|
|
4016
|
+
convertMediaPart: this.config.convertMediaPart
|
|
3982
4017
|
});
|
|
3983
4018
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
3984
4019
|
const requestedThinking = anthropicOptions.thinking;
|
|
@@ -4088,7 +4123,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4088
4123
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
4089
4124
|
cache_control: anthropicOptions.cacheControl
|
|
4090
4125
|
},
|
|
4091
|
-
...((
|
|
4126
|
+
...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
|
|
4092
4127
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
4093
4128
|
},
|
|
4094
4129
|
// mcp servers:
|
|
@@ -4196,7 +4231,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4196
4231
|
};
|
|
4197
4232
|
thinkingBudget = 1024;
|
|
4198
4233
|
}
|
|
4199
|
-
if (baseArgs.temperature != null) {
|
|
4234
|
+
if (baseArgs.temperature != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4200
4235
|
baseArgs.temperature = void 0;
|
|
4201
4236
|
warnings.push({
|
|
4202
4237
|
type: "unsupported",
|
|
@@ -4212,7 +4247,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4212
4247
|
details: "topK is not supported when thinking is enabled"
|
|
4213
4248
|
});
|
|
4214
4249
|
}
|
|
4215
|
-
if (topP != null) {
|
|
4250
|
+
if (topP != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4216
4251
|
baseArgs.top_p = void 0;
|
|
4217
4252
|
warnings.push({
|
|
4218
4253
|
type: "unsupported",
|
|
@@ -4283,7 +4318,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4283
4318
|
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
4284
4319
|
betas.add("server-side-fallback-2026-06-01");
|
|
4285
4320
|
}
|
|
4286
|
-
const defaultEagerInputStreaming = stream && ((
|
|
4321
|
+
const defaultEagerInputStreaming = stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true);
|
|
4287
4322
|
const {
|
|
4288
4323
|
tools: anthropicTools2,
|
|
4289
4324
|
toolChoice: anthropicToolChoice,
|
|
@@ -4324,7 +4359,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4324
4359
|
...betas,
|
|
4325
4360
|
...toolsBetas,
|
|
4326
4361
|
...userSuppliedBetas,
|
|
4327
|
-
...(
|
|
4362
|
+
...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
|
|
4328
4363
|
]),
|
|
4329
4364
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
4330
4365
|
toolNameMapping,
|
|
@@ -6130,12 +6165,12 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6130
6165
|
// src/tool/bash_20241022.ts
|
|
6131
6166
|
import {
|
|
6132
6167
|
createProviderToolFactory as createProviderToolFactory3,
|
|
6133
|
-
lazySchema as
|
|
6134
|
-
zodSchema as
|
|
6168
|
+
lazySchema as lazySchema15,
|
|
6169
|
+
zodSchema as zodSchema15
|
|
6135
6170
|
} from "@ai-sdk/provider-utils";
|
|
6136
6171
|
import { z as z15 } from "zod/v4";
|
|
6137
|
-
var bash_20241022InputSchema =
|
|
6138
|
-
() =>
|
|
6172
|
+
var bash_20241022InputSchema = lazySchema15(
|
|
6173
|
+
() => zodSchema15(
|
|
6139
6174
|
z15.object({
|
|
6140
6175
|
command: z15.string(),
|
|
6141
6176
|
restart: z15.boolean().optional()
|
|
@@ -6150,12 +6185,12 @@ var bash_20241022 = createProviderToolFactory3({
|
|
|
6150
6185
|
// src/tool/bash_20250124.ts
|
|
6151
6186
|
import {
|
|
6152
6187
|
createProviderToolFactory as createProviderToolFactory4,
|
|
6153
|
-
lazySchema as
|
|
6154
|
-
zodSchema as
|
|
6188
|
+
lazySchema as lazySchema16,
|
|
6189
|
+
zodSchema as zodSchema16
|
|
6155
6190
|
} from "@ai-sdk/provider-utils";
|
|
6156
6191
|
import { z as z16 } from "zod/v4";
|
|
6157
|
-
var bash_20250124InputSchema =
|
|
6158
|
-
() =>
|
|
6192
|
+
var bash_20250124InputSchema = lazySchema16(
|
|
6193
|
+
() => zodSchema16(
|
|
6159
6194
|
z16.object({
|
|
6160
6195
|
command: z16.string(),
|
|
6161
6196
|
restart: z16.boolean().optional()
|
|
@@ -6170,12 +6205,12 @@ var bash_20250124 = createProviderToolFactory4({
|
|
|
6170
6205
|
// src/tool/computer_20241022.ts
|
|
6171
6206
|
import {
|
|
6172
6207
|
createProviderToolFactory as createProviderToolFactory5,
|
|
6173
|
-
lazySchema as
|
|
6174
|
-
zodSchema as
|
|
6208
|
+
lazySchema as lazySchema17,
|
|
6209
|
+
zodSchema as zodSchema17
|
|
6175
6210
|
} from "@ai-sdk/provider-utils";
|
|
6176
6211
|
import { z as z17 } from "zod/v4";
|
|
6177
|
-
var computer_20241022InputSchema =
|
|
6178
|
-
() =>
|
|
6212
|
+
var computer_20241022InputSchema = lazySchema17(
|
|
6213
|
+
() => zodSchema17(
|
|
6179
6214
|
z17.object({
|
|
6180
6215
|
action: z17.enum([
|
|
6181
6216
|
"key",
|
|
@@ -6202,12 +6237,12 @@ var computer_20241022 = createProviderToolFactory5({
|
|
|
6202
6237
|
// src/tool/computer_20250124.ts
|
|
6203
6238
|
import {
|
|
6204
6239
|
createProviderToolFactory as createProviderToolFactory6,
|
|
6205
|
-
lazySchema as
|
|
6206
|
-
zodSchema as
|
|
6240
|
+
lazySchema as lazySchema18,
|
|
6241
|
+
zodSchema as zodSchema18
|
|
6207
6242
|
} from "@ai-sdk/provider-utils";
|
|
6208
6243
|
import { z as z18 } from "zod/v4";
|
|
6209
|
-
var computer_20250124InputSchema =
|
|
6210
|
-
() =>
|
|
6244
|
+
var computer_20250124InputSchema = lazySchema18(
|
|
6245
|
+
() => zodSchema18(
|
|
6211
6246
|
z18.object({
|
|
6212
6247
|
action: z18.enum([
|
|
6213
6248
|
"key",
|
|
@@ -6244,12 +6279,12 @@ var computer_20250124 = createProviderToolFactory6({
|
|
|
6244
6279
|
// src/tool/computer_20251124.ts
|
|
6245
6280
|
import {
|
|
6246
6281
|
createProviderToolFactory as createProviderToolFactory7,
|
|
6247
|
-
lazySchema as
|
|
6248
|
-
zodSchema as
|
|
6282
|
+
lazySchema as lazySchema19,
|
|
6283
|
+
zodSchema as zodSchema19
|
|
6249
6284
|
} from "@ai-sdk/provider-utils";
|
|
6250
6285
|
import { z as z19 } from "zod/v4";
|
|
6251
|
-
var computer_20251124InputSchema =
|
|
6252
|
-
() =>
|
|
6286
|
+
var computer_20251124InputSchema = lazySchema19(
|
|
6287
|
+
() => zodSchema19(
|
|
6253
6288
|
z19.object({
|
|
6254
6289
|
action: z19.enum([
|
|
6255
6290
|
"key",
|
|
@@ -6293,12 +6328,12 @@ var computer_20251124 = createProviderToolFactory7({
|
|
|
6293
6328
|
// src/tool/memory_20250818.ts
|
|
6294
6329
|
import {
|
|
6295
6330
|
createProviderToolFactory as createProviderToolFactory8,
|
|
6296
|
-
lazySchema as
|
|
6297
|
-
zodSchema as
|
|
6331
|
+
lazySchema as lazySchema20,
|
|
6332
|
+
zodSchema as zodSchema20
|
|
6298
6333
|
} from "@ai-sdk/provider-utils";
|
|
6299
6334
|
import { z as z20 } from "zod/v4";
|
|
6300
|
-
var memory_20250818InputSchema =
|
|
6301
|
-
() =>
|
|
6335
|
+
var memory_20250818InputSchema = lazySchema20(
|
|
6336
|
+
() => zodSchema20(
|
|
6302
6337
|
z20.discriminatedUnion("command", [
|
|
6303
6338
|
z20.object({
|
|
6304
6339
|
command: z20.literal("view"),
|
|
@@ -6342,12 +6377,12 @@ var memory_20250818 = createProviderToolFactory8({
|
|
|
6342
6377
|
// src/tool/text-editor_20241022.ts
|
|
6343
6378
|
import {
|
|
6344
6379
|
createProviderToolFactory as createProviderToolFactory9,
|
|
6345
|
-
lazySchema as
|
|
6346
|
-
zodSchema as
|
|
6380
|
+
lazySchema as lazySchema21,
|
|
6381
|
+
zodSchema as zodSchema21
|
|
6347
6382
|
} from "@ai-sdk/provider-utils";
|
|
6348
6383
|
import { z as z21 } from "zod/v4";
|
|
6349
|
-
var textEditor_20241022InputSchema =
|
|
6350
|
-
() =>
|
|
6384
|
+
var textEditor_20241022InputSchema = lazySchema21(
|
|
6385
|
+
() => zodSchema21(
|
|
6351
6386
|
z21.object({
|
|
6352
6387
|
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6353
6388
|
path: z21.string(),
|
|
@@ -6368,12 +6403,12 @@ var textEditor_20241022 = createProviderToolFactory9({
|
|
|
6368
6403
|
// src/tool/text-editor_20250124.ts
|
|
6369
6404
|
import {
|
|
6370
6405
|
createProviderToolFactory as createProviderToolFactory10,
|
|
6371
|
-
lazySchema as
|
|
6372
|
-
zodSchema as
|
|
6406
|
+
lazySchema as lazySchema22,
|
|
6407
|
+
zodSchema as zodSchema22
|
|
6373
6408
|
} from "@ai-sdk/provider-utils";
|
|
6374
6409
|
import { z as z22 } from "zod/v4";
|
|
6375
|
-
var textEditor_20250124InputSchema =
|
|
6376
|
-
() =>
|
|
6410
|
+
var textEditor_20250124InputSchema = lazySchema22(
|
|
6411
|
+
() => zodSchema22(
|
|
6377
6412
|
z22.object({
|
|
6378
6413
|
command: z22.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6379
6414
|
path: z22.string(),
|
|
@@ -6394,12 +6429,12 @@ var textEditor_20250124 = createProviderToolFactory10({
|
|
|
6394
6429
|
// src/tool/text-editor_20250429.ts
|
|
6395
6430
|
import {
|
|
6396
6431
|
createProviderToolFactory as createProviderToolFactory11,
|
|
6397
|
-
lazySchema as
|
|
6398
|
-
zodSchema as
|
|
6432
|
+
lazySchema as lazySchema23,
|
|
6433
|
+
zodSchema as zodSchema23
|
|
6399
6434
|
} from "@ai-sdk/provider-utils";
|
|
6400
6435
|
import { z as z23 } from "zod/v4";
|
|
6401
|
-
var textEditor_20250429InputSchema =
|
|
6402
|
-
() =>
|
|
6436
|
+
var textEditor_20250429InputSchema = lazySchema23(
|
|
6437
|
+
() => zodSchema23(
|
|
6403
6438
|
z23.object({
|
|
6404
6439
|
command: z23.enum(["view", "create", "str_replace", "insert"]),
|
|
6405
6440
|
path: z23.string(),
|
|
@@ -6420,12 +6455,12 @@ var textEditor_20250429 = createProviderToolFactory11({
|
|
|
6420
6455
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6421
6456
|
import {
|
|
6422
6457
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
6423
|
-
lazySchema as
|
|
6424
|
-
zodSchema as
|
|
6458
|
+
lazySchema as lazySchema24,
|
|
6459
|
+
zodSchema as zodSchema24
|
|
6425
6460
|
} from "@ai-sdk/provider-utils";
|
|
6426
6461
|
import { z as z24 } from "zod/v4";
|
|
6427
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
6428
|
-
() =>
|
|
6462
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema24(
|
|
6463
|
+
() => zodSchema24(
|
|
6429
6464
|
z24.array(
|
|
6430
6465
|
z24.object({
|
|
6431
6466
|
type: z24.literal("tool_reference"),
|
|
@@ -6434,8 +6469,8 @@ var toolSearchBm25_20251119OutputSchema = lazySchema23(
|
|
|
6434
6469
|
)
|
|
6435
6470
|
)
|
|
6436
6471
|
);
|
|
6437
|
-
var toolSearchBm25_20251119InputSchema =
|
|
6438
|
-
() =>
|
|
6472
|
+
var toolSearchBm25_20251119InputSchema = lazySchema24(
|
|
6473
|
+
() => zodSchema24(
|
|
6439
6474
|
z24.object({
|
|
6440
6475
|
/**
|
|
6441
6476
|
* A natural language query to search for tools.
|