@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/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
14
|
// src/version.ts
|
|
15
|
-
var VERSION = true ? "3.0.
|
|
15
|
+
var VERSION = true ? "3.0.135" : "0.0.0-test";
|
|
16
16
|
|
|
17
17
|
// src/anthropic-messages-language-model.ts
|
|
18
18
|
import {
|
|
@@ -60,13 +60,13 @@ import {
|
|
|
60
60
|
zodSchema as zodSchema2
|
|
61
61
|
} from "@ai-sdk/provider-utils";
|
|
62
62
|
import { z as z2 } from "zod/v4";
|
|
63
|
-
var anthropicStopDetailsSchema = z2.object({
|
|
63
|
+
var anthropicStopDetailsSchema = () => z2.object({
|
|
64
64
|
type: z2.string(),
|
|
65
65
|
category: z2.string().nullish(),
|
|
66
66
|
explanation: z2.string().nullish(),
|
|
67
67
|
recommended_model: z2.string().nullish()
|
|
68
68
|
});
|
|
69
|
-
var anthropicSafeguardResultSchema = z2.object({
|
|
69
|
+
var anthropicSafeguardResultSchema = () => z2.object({
|
|
70
70
|
type: z2.string(),
|
|
71
71
|
status: z2.object({
|
|
72
72
|
type: z2.string(),
|
|
@@ -80,7 +80,7 @@ var anthropicSafeguardResultSchema = z2.object({
|
|
|
80
80
|
).nullish()
|
|
81
81
|
})
|
|
82
82
|
});
|
|
83
|
-
var anthropicToolCallCallerSchema = z2.union([
|
|
83
|
+
var anthropicToolCallCallerSchema = () => z2.union([
|
|
84
84
|
z2.object({
|
|
85
85
|
type: z2.literal("code_execution_20250825"),
|
|
86
86
|
tool_id: z2.string()
|
|
@@ -93,7 +93,7 @@ var anthropicToolCallCallerSchema = z2.union([
|
|
|
93
93
|
type: z2.literal("direct")
|
|
94
94
|
})
|
|
95
95
|
]);
|
|
96
|
-
var anthropicInputTransformationSchema = z2.object({
|
|
96
|
+
var anthropicInputTransformationSchema = () => z2.object({
|
|
97
97
|
type: z2.string(),
|
|
98
98
|
path: z2.string(),
|
|
99
99
|
reason: z2.string()
|
|
@@ -156,7 +156,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
156
156
|
name: z2.string(),
|
|
157
157
|
input: z2.unknown(),
|
|
158
158
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
159
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
159
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
160
160
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
161
161
|
toolset_name: z2.string().nullish()
|
|
162
162
|
}),
|
|
@@ -165,7 +165,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
165
165
|
id: z2.string(),
|
|
166
166
|
name: z2.string(),
|
|
167
167
|
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
168
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
168
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
169
169
|
}),
|
|
170
170
|
z2.object({
|
|
171
171
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -188,7 +188,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
188
188
|
z2.object({
|
|
189
189
|
type: z2.literal("web_fetch_tool_result"),
|
|
190
190
|
tool_use_id: z2.string(),
|
|
191
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
191
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
192
192
|
content: z2.union([
|
|
193
193
|
z2.object({
|
|
194
194
|
type: z2.literal("web_fetch_result"),
|
|
@@ -221,7 +221,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
221
221
|
z2.object({
|
|
222
222
|
type: z2.literal("web_search_tool_result"),
|
|
223
223
|
tool_use_id: z2.string(),
|
|
224
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
224
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
225
225
|
content: z2.union([
|
|
226
226
|
z2.array(
|
|
227
227
|
z2.object({
|
|
@@ -378,9 +378,9 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
378
378
|
),
|
|
379
379
|
stop_reason: z2.string().nullish(),
|
|
380
380
|
stop_sequence: z2.string().nullish(),
|
|
381
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
382
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
383
|
-
safeguard_results: z2.array(anthropicSafeguardResultSchema).nullish(),
|
|
381
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
382
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
383
|
+
safeguard_results: z2.array(anthropicSafeguardResultSchema()).nullish(),
|
|
384
384
|
usage: z2.looseObject({
|
|
385
385
|
input_tokens: z2.number(),
|
|
386
386
|
output_tokens: z2.number(),
|
|
@@ -460,13 +460,13 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
460
460
|
id: z2.string(),
|
|
461
461
|
name: z2.string(),
|
|
462
462
|
input: z2.unknown(),
|
|
463
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
463
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
464
464
|
toolset_name: z2.string().nullish()
|
|
465
465
|
})
|
|
466
466
|
])
|
|
467
467
|
).nullish(),
|
|
468
468
|
stop_reason: z2.string().nullish(),
|
|
469
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
469
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
470
470
|
container: z2.object({
|
|
471
471
|
expires_at: z2.string(),
|
|
472
472
|
id: z2.string()
|
|
@@ -492,7 +492,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
492
492
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
493
493
|
input: z2.record(z2.string(), z2.unknown()).optional(),
|
|
494
494
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
495
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
495
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
496
496
|
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
497
497
|
toolset_name: z2.string().nullish()
|
|
498
498
|
}),
|
|
@@ -509,7 +509,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
509
509
|
id: z2.string(),
|
|
510
510
|
name: z2.string(),
|
|
511
511
|
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
512
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
512
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
513
513
|
}),
|
|
514
514
|
z2.object({
|
|
515
515
|
type: z2.literal("mcp_tool_use"),
|
|
@@ -532,7 +532,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
532
532
|
z2.object({
|
|
533
533
|
type: z2.literal("web_fetch_tool_result"),
|
|
534
534
|
tool_use_id: z2.string(),
|
|
535
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
535
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
536
536
|
content: z2.union([
|
|
537
537
|
z2.object({
|
|
538
538
|
type: z2.literal("web_fetch_result"),
|
|
@@ -565,7 +565,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
565
565
|
z2.object({
|
|
566
566
|
type: z2.literal("web_search_tool_result"),
|
|
567
567
|
tool_use_id: z2.string(),
|
|
568
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
568
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
569
569
|
content: z2.union([
|
|
570
570
|
z2.array(
|
|
571
571
|
z2.object({
|
|
@@ -789,8 +789,8 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
789
789
|
delta: z2.object({
|
|
790
790
|
stop_reason: z2.string().nullish(),
|
|
791
791
|
stop_sequence: z2.string().nullish(),
|
|
792
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
793
|
-
safeguard_results: z2.array(anthropicSafeguardResultSchema).nullish(),
|
|
792
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
793
|
+
safeguard_results: z2.array(anthropicSafeguardResultSchema()).nullish(),
|
|
794
794
|
container: z2.object({
|
|
795
795
|
expires_at: z2.string(),
|
|
796
796
|
id: z2.string(),
|
|
@@ -830,7 +830,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
830
830
|
})
|
|
831
831
|
).nullish()
|
|
832
832
|
}),
|
|
833
|
-
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
833
|
+
input_transformations: z2.array(anthropicInputTransformationSchema()).nullish(),
|
|
834
834
|
context_management: z2.object({
|
|
835
835
|
applied_edits: z2.array(
|
|
836
836
|
z2.union([
|
|
@@ -870,349 +870,365 @@ var anthropicReasoningMetadataSchema = lazySchema2(
|
|
|
870
870
|
);
|
|
871
871
|
|
|
872
872
|
// src/anthropic-messages-options.ts
|
|
873
|
+
import {
|
|
874
|
+
lazySchema as lazySchema3,
|
|
875
|
+
zodSchema as zodSchema3
|
|
876
|
+
} from "@ai-sdk/provider-utils";
|
|
873
877
|
import { z as z3 } from "zod/v4";
|
|
874
|
-
var anthropicFilePartProviderOptions =
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
*/
|
|
883
|
-
enabled: z3.boolean()
|
|
884
|
-
}).optional(),
|
|
885
|
-
/**
|
|
886
|
-
* Custom title for the document.
|
|
887
|
-
* If not provided, the filename will be used.
|
|
888
|
-
*/
|
|
889
|
-
title: z3.string().optional(),
|
|
890
|
-
/**
|
|
891
|
-
* Context about the document that will be passed to the model
|
|
892
|
-
* but not used towards cited content.
|
|
893
|
-
* Useful for storing document metadata as text or stringified JSON.
|
|
894
|
-
*/
|
|
895
|
-
context: z3.string().optional()
|
|
896
|
-
});
|
|
897
|
-
var anthropicSystemMessageProviderOptions = z3.object({
|
|
898
|
-
/**
|
|
899
|
-
* Clears this mid-conversation system message after the current turn.
|
|
900
|
-
*
|
|
901
|
-
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
902
|
-
* which is added automatically.
|
|
903
|
-
*/
|
|
904
|
-
clearAt: z3.literal("next_user_message").optional(),
|
|
905
|
-
/**
|
|
906
|
-
* Sets the model effort from the next user turn until a later message
|
|
907
|
-
* changes it. An effort-only system message with empty content can appear
|
|
908
|
-
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
909
|
-
* added automatically.
|
|
910
|
-
*/
|
|
911
|
-
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
912
|
-
/**
|
|
913
|
-
* Mid-conversation tool changes. Adds or removes tools from the
|
|
914
|
-
* conversation's tool set between turns without invalidating the prompt
|
|
915
|
-
* cache.
|
|
916
|
-
*
|
|
917
|
-
* Only supported on system messages that appear mid-conversation (not the
|
|
918
|
-
* initial system prompt). A system message carrying tool changes must come
|
|
919
|
-
* right before an assistant message or at the end of the messages.
|
|
920
|
-
*
|
|
921
|
-
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
922
|
-
* option (typically with `deferLoading: true` so they are not loaded until
|
|
923
|
-
* the addition surfaces them). The required
|
|
924
|
-
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
925
|
-
*/
|
|
926
|
-
toolChanges: z3.array(
|
|
927
|
-
z3.discriminatedUnion("type", [
|
|
928
|
-
z3.object({
|
|
929
|
-
type: z3.literal("tool_addition"),
|
|
930
|
-
toolName: z3.string()
|
|
931
|
-
}),
|
|
932
|
-
z3.object({
|
|
933
|
-
type: z3.literal("tool_removal"),
|
|
934
|
-
toolName: z3.string()
|
|
935
|
-
})
|
|
936
|
-
])
|
|
937
|
-
).optional()
|
|
938
|
-
});
|
|
939
|
-
var anthropicThinkingBlockBinding = z3.object({
|
|
940
|
-
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
941
|
-
});
|
|
942
|
-
var anthropicLanguageModelOptions = z3.object({
|
|
943
|
-
/**
|
|
944
|
-
* Whether to send reasoning to the model.
|
|
945
|
-
*
|
|
946
|
-
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
947
|
-
*/
|
|
948
|
-
sendReasoning: z3.boolean().optional(),
|
|
949
|
-
/**
|
|
950
|
-
* Determines how structured outputs are generated.
|
|
951
|
-
*
|
|
952
|
-
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
953
|
-
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
954
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
955
|
-
*/
|
|
956
|
-
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
957
|
-
/**
|
|
958
|
-
* Configuration for enabling Claude's extended thinking.
|
|
959
|
-
*
|
|
960
|
-
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
961
|
-
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
962
|
-
*
|
|
963
|
-
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
964
|
-
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
965
|
-
* provider drops the unsupported setting, emits a warning, and sends an
|
|
966
|
-
* adaptive thinking request. Use `effort` to control how much they think.
|
|
967
|
-
*
|
|
968
|
-
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
969
|
-
* and the provider uses it in place of `disabled` for that model.
|
|
970
|
-
*/
|
|
971
|
-
thinking: z3.union([
|
|
972
|
-
z3.discriminatedUnion("type", [
|
|
973
|
-
z3.object({
|
|
974
|
-
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
975
|
-
type: z3.literal("adaptive"),
|
|
976
|
-
/**
|
|
977
|
-
* Controls whether thinking content is included in the response.
|
|
978
|
-
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
979
|
-
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
980
|
-
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
981
|
-
*/
|
|
982
|
-
display: z3.enum(["omitted", "summarized", "updates"]).optional(),
|
|
983
|
-
/**
|
|
984
|
-
* Controls how thinking blocks are bound to an assistant prefix.
|
|
985
|
-
*
|
|
986
|
-
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
987
|
-
* which is added automatically.
|
|
988
|
-
*/
|
|
989
|
-
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
990
|
-
}),
|
|
991
|
-
z3.object({
|
|
992
|
-
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
993
|
-
type: z3.literal("enabled"),
|
|
994
|
-
budgetTokens: z3.number().optional()
|
|
995
|
-
}),
|
|
996
|
-
z3.object({
|
|
997
|
-
type: z3.literal("disabled")
|
|
998
|
-
}),
|
|
999
|
-
z3.object({
|
|
878
|
+
var anthropicFilePartProviderOptions = lazySchema3(
|
|
879
|
+
() => zodSchema3(
|
|
880
|
+
z3.object({
|
|
881
|
+
/**
|
|
882
|
+
* Citation configuration for this document.
|
|
883
|
+
* When enabled, this document will generate citations in the response.
|
|
884
|
+
*/
|
|
885
|
+
citations: z3.object({
|
|
1000
886
|
/**
|
|
1001
|
-
*
|
|
1002
|
-
* between tool calls are returned as summarized thinking blocks.
|
|
1003
|
-
* Only supported at `low`, `medium`, and `high` effort.
|
|
887
|
+
* Enable citations for this document
|
|
1004
888
|
*/
|
|
1005
|
-
|
|
1006
|
-
})
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
889
|
+
enabled: z3.boolean()
|
|
890
|
+
}).optional(),
|
|
891
|
+
/**
|
|
892
|
+
* Custom title for the document.
|
|
893
|
+
* If not provided, the filename will be used.
|
|
894
|
+
*/
|
|
895
|
+
title: z3.string().optional(),
|
|
896
|
+
/**
|
|
897
|
+
* Context about the document that will be passed to the model
|
|
898
|
+
* but not used towards cited content.
|
|
899
|
+
* Useful for storing document metadata as text or stringified JSON.
|
|
900
|
+
*/
|
|
901
|
+
context: z3.string().optional()
|
|
1014
902
|
})
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
*/
|
|
1020
|
-
disableParallelToolUse: z3.boolean().optional(),
|
|
1021
|
-
/**
|
|
1022
|
-
* Cache control settings for this message.
|
|
1023
|
-
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1024
|
-
*/
|
|
1025
|
-
cacheControl: z3.object({
|
|
1026
|
-
type: z3.literal("ephemeral"),
|
|
1027
|
-
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
1028
|
-
}).optional(),
|
|
1029
|
-
/**
|
|
1030
|
-
* Metadata to include with the request.
|
|
1031
|
-
*
|
|
1032
|
-
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1033
|
-
*/
|
|
1034
|
-
metadata: z3.object({
|
|
1035
|
-
/**
|
|
1036
|
-
* An external identifier for the user associated with the request.
|
|
1037
|
-
*
|
|
1038
|
-
* Should be a UUID, hash value, or other opaque identifier.
|
|
1039
|
-
* Must not contain PII (name, email, phone number, etc.).
|
|
1040
|
-
*/
|
|
1041
|
-
userId: z3.string().optional()
|
|
1042
|
-
}).optional(),
|
|
1043
|
-
/**
|
|
1044
|
-
* MCP servers to be utilized in this request.
|
|
1045
|
-
*/
|
|
1046
|
-
mcpServers: z3.array(
|
|
903
|
+
)
|
|
904
|
+
);
|
|
905
|
+
var anthropicSystemMessageProviderOptions = lazySchema3(
|
|
906
|
+
() => zodSchema3(
|
|
1047
907
|
z3.object({
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
908
|
+
/**
|
|
909
|
+
* Clears this mid-conversation system message after the current turn.
|
|
910
|
+
*
|
|
911
|
+
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
912
|
+
* which is added automatically.
|
|
913
|
+
*/
|
|
914
|
+
clearAt: z3.literal("next_user_message").optional(),
|
|
915
|
+
/**
|
|
916
|
+
* Sets the model effort from the next user turn until a later message
|
|
917
|
+
* changes it. An effort-only system message with empty content can appear
|
|
918
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
919
|
+
* added automatically.
|
|
920
|
+
*/
|
|
921
|
+
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
922
|
+
/**
|
|
923
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
924
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
925
|
+
* cache.
|
|
926
|
+
*
|
|
927
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
928
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
929
|
+
* right before an assistant message or at the end of the messages.
|
|
930
|
+
*
|
|
931
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
932
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
933
|
+
* the addition surfaces them). The required
|
|
934
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
935
|
+
*/
|
|
936
|
+
toolChanges: z3.array(
|
|
937
|
+
z3.discriminatedUnion("type", [
|
|
938
|
+
z3.object({
|
|
939
|
+
type: z3.literal("tool_addition"),
|
|
940
|
+
toolName: z3.string()
|
|
941
|
+
}),
|
|
942
|
+
z3.object({
|
|
943
|
+
type: z3.literal("tool_removal"),
|
|
944
|
+
toolName: z3.string()
|
|
945
|
+
})
|
|
946
|
+
])
|
|
947
|
+
).optional()
|
|
1056
948
|
})
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
id: z3.string().optional(),
|
|
1065
|
-
skills: z3.array(
|
|
1066
|
-
z3.object({
|
|
1067
|
-
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
1068
|
-
skillId: z3.string(),
|
|
1069
|
-
version: z3.string().optional()
|
|
1070
|
-
})
|
|
1071
|
-
).optional()
|
|
1072
|
-
}).optional(),
|
|
1073
|
-
/**
|
|
1074
|
-
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1075
|
-
* and structured outputs for every function tool in the request. When
|
|
1076
|
-
* true (the default), each function tool receives a default of
|
|
1077
|
-
* `eager_input_streaming: true` unless it explicitly sets
|
|
1078
|
-
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1079
|
-
*
|
|
1080
|
-
* @default true
|
|
1081
|
-
*/
|
|
1082
|
-
toolStreaming: z3.boolean().optional(),
|
|
1083
|
-
/**
|
|
1084
|
-
* Controls how much effort the model spends on thinking, text responses,
|
|
1085
|
-
* and tool calls. On models that always use adaptive thinking
|
|
1086
|
-
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1087
|
-
*
|
|
1088
|
-
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1089
|
-
*/
|
|
1090
|
-
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1091
|
-
/**
|
|
1092
|
-
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1093
|
-
* available for the current task, allowing it to prioritize work and wind down
|
|
1094
|
-
* gracefully as the budget is consumed.
|
|
1095
|
-
*
|
|
1096
|
-
* Advisory only — does not enforce a hard token limit.
|
|
1097
|
-
*/
|
|
1098
|
-
taskBudget: z3.object({
|
|
1099
|
-
type: z3.literal("tokens"),
|
|
1100
|
-
total: z3.number().int().min(2e4),
|
|
1101
|
-
remaining: z3.number().int().min(0).optional()
|
|
1102
|
-
}).optional(),
|
|
1103
|
-
/**
|
|
1104
|
-
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1105
|
-
* Only supported with claude-opus-4-6.
|
|
1106
|
-
*/
|
|
1107
|
-
speed: z3.enum(["fast", "standard"]).optional(),
|
|
1108
|
-
/**
|
|
1109
|
-
* Controls where model inference runs for this request.
|
|
1110
|
-
*
|
|
1111
|
-
* - `"global"`: Inference may run in any available geography (default).
|
|
1112
|
-
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1113
|
-
*
|
|
1114
|
-
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1115
|
-
*/
|
|
1116
|
-
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
1117
|
-
/**
|
|
1118
|
-
* Server-side fallback configuration.
|
|
1119
|
-
*
|
|
1120
|
-
* When the primary model's safety classifiers block a turn, the API
|
|
1121
|
-
* automatically retries it server-side on a fallback model. A
|
|
1122
|
-
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1123
|
-
*
|
|
1124
|
-
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1125
|
-
* recommended fallback model based on the refusal category. Requires the
|
|
1126
|
-
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1127
|
-
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1128
|
-
* request as a direct request to that entry's model, so it must be
|
|
1129
|
-
* formatted accordingly: `model` is required, and an entry may
|
|
1130
|
-
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1131
|
-
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1132
|
-
* beta). The value is passed through to the API as-is, and the
|
|
1133
|
-
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1134
|
-
*/
|
|
1135
|
-
fallbacks: z3.union([
|
|
1136
|
-
z3.literal("default"),
|
|
1137
|
-
z3.array(
|
|
1138
|
-
z3.object({
|
|
1139
|
-
model: z3.string(),
|
|
1140
|
-
max_tokens: z3.number().int().optional(),
|
|
1141
|
-
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1142
|
-
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1143
|
-
speed: z3.enum(["fast", "standard"]).optional()
|
|
1144
|
-
})
|
|
1145
|
-
)
|
|
1146
|
-
]).optional(),
|
|
1147
|
-
/**
|
|
1148
|
-
* A set of beta features to enable.
|
|
1149
|
-
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1150
|
-
*/
|
|
1151
|
-
anthropicBeta: z3.array(z3.string()).optional(),
|
|
1152
|
-
/**
|
|
1153
|
-
* Server-side safeguards to run as part of the request.
|
|
1154
|
-
*
|
|
1155
|
-
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1156
|
-
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1157
|
-
* relies on). The per-call verdicts are returned in
|
|
1158
|
-
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1159
|
-
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1160
|
-
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1161
|
-
*/
|
|
1162
|
-
safeguards: z3.array(
|
|
949
|
+
)
|
|
950
|
+
);
|
|
951
|
+
var anthropicLanguageModelOptions = lazySchema3(() => {
|
|
952
|
+
const anthropicThinkingBlockBinding = z3.object({
|
|
953
|
+
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
954
|
+
});
|
|
955
|
+
return zodSchema3(
|
|
1163
956
|
z3.object({
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
957
|
+
/**
|
|
958
|
+
* Whether to send reasoning to the model.
|
|
959
|
+
*
|
|
960
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
961
|
+
*/
|
|
962
|
+
sendReasoning: z3.boolean().optional(),
|
|
963
|
+
/**
|
|
964
|
+
* Determines how structured outputs are generated.
|
|
965
|
+
*
|
|
966
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
967
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
968
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
969
|
+
*/
|
|
970
|
+
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
971
|
+
/**
|
|
972
|
+
* Configuration for enabling Claude's extended thinking.
|
|
973
|
+
*
|
|
974
|
+
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
975
|
+
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
976
|
+
*
|
|
977
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
978
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
979
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
980
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
981
|
+
*
|
|
982
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
983
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
984
|
+
*/
|
|
985
|
+
thinking: z3.union([
|
|
986
|
+
z3.discriminatedUnion("type", [
|
|
987
|
+
z3.object({
|
|
988
|
+
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
989
|
+
type: z3.literal("adaptive"),
|
|
990
|
+
/**
|
|
991
|
+
* Controls whether thinking content is included in the response.
|
|
992
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
993
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
994
|
+
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
995
|
+
*/
|
|
996
|
+
display: z3.enum(["omitted", "summarized", "updates"]).optional(),
|
|
997
|
+
/**
|
|
998
|
+
* Controls how thinking blocks are bound to an assistant prefix.
|
|
999
|
+
*
|
|
1000
|
+
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
1001
|
+
* which is added automatically.
|
|
1002
|
+
*/
|
|
1003
|
+
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
1004
|
+
}),
|
|
1005
|
+
z3.object({
|
|
1006
|
+
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
1007
|
+
type: z3.literal("enabled"),
|
|
1008
|
+
budgetTokens: z3.number().optional()
|
|
1009
|
+
}),
|
|
1010
|
+
z3.object({
|
|
1011
|
+
type: z3.literal("disabled")
|
|
1012
|
+
}),
|
|
1013
|
+
z3.object({
|
|
1014
|
+
/**
|
|
1015
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1016
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1017
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1018
|
+
*/
|
|
1019
|
+
type: z3.literal("between_tools")
|
|
1020
|
+
})
|
|
1021
|
+
]),
|
|
1022
|
+
/**
|
|
1023
|
+
* Configures prefix mismatch recovery without changing the model's
|
|
1024
|
+
* default thinking mode.
|
|
1025
|
+
*/
|
|
1026
|
+
z3.object({
|
|
1027
|
+
blockBinding: anthropicThinkingBlockBinding
|
|
1028
|
+
})
|
|
1029
|
+
]).optional(),
|
|
1030
|
+
/**
|
|
1031
|
+
* Whether to disable parallel function calling during tool use. Default is false.
|
|
1032
|
+
* When set to true, Claude will use at most one tool per response.
|
|
1033
|
+
*/
|
|
1034
|
+
disableParallelToolUse: z3.boolean().optional(),
|
|
1035
|
+
/**
|
|
1036
|
+
* Cache control settings for this message.
|
|
1037
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1038
|
+
*/
|
|
1039
|
+
cacheControl: z3.object({
|
|
1040
|
+
type: z3.literal("ephemeral"),
|
|
1041
|
+
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
1042
|
+
}).optional(),
|
|
1043
|
+
/**
|
|
1044
|
+
* Metadata to include with the request.
|
|
1045
|
+
*
|
|
1046
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1047
|
+
*/
|
|
1048
|
+
metadata: z3.object({
|
|
1049
|
+
/**
|
|
1050
|
+
* An external identifier for the user associated with the request.
|
|
1051
|
+
*
|
|
1052
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
1053
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
1054
|
+
*/
|
|
1055
|
+
userId: z3.string().optional()
|
|
1056
|
+
}).optional(),
|
|
1057
|
+
/**
|
|
1058
|
+
* MCP servers to be utilized in this request.
|
|
1059
|
+
*/
|
|
1060
|
+
mcpServers: z3.array(
|
|
1171
1061
|
z3.object({
|
|
1172
|
-
type: z3.literal("
|
|
1173
|
-
|
|
1062
|
+
type: z3.literal("url"),
|
|
1063
|
+
name: z3.string(),
|
|
1064
|
+
url: z3.string(),
|
|
1065
|
+
authorizationToken: z3.string().nullish(),
|
|
1066
|
+
toolConfiguration: z3.object({
|
|
1067
|
+
enabled: z3.boolean().nullish(),
|
|
1068
|
+
allowedTools: z3.array(z3.string()).nullish()
|
|
1069
|
+
}).nullish()
|
|
1070
|
+
})
|
|
1071
|
+
).optional(),
|
|
1072
|
+
/**
|
|
1073
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
1074
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
1075
|
+
* Requires code execution tool to be enabled.
|
|
1076
|
+
*/
|
|
1077
|
+
container: z3.object({
|
|
1078
|
+
id: z3.string().optional(),
|
|
1079
|
+
skills: z3.array(
|
|
1080
|
+
z3.object({
|
|
1081
|
+
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
1082
|
+
skillId: z3.string(),
|
|
1083
|
+
version: z3.string().optional()
|
|
1084
|
+
})
|
|
1085
|
+
).optional()
|
|
1086
|
+
}).optional(),
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1089
|
+
* and structured outputs for every function tool in the request. When
|
|
1090
|
+
* true (the default), each function tool receives a default of
|
|
1091
|
+
* `eager_input_streaming: true` unless it explicitly sets
|
|
1092
|
+
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1093
|
+
*
|
|
1094
|
+
* @default true
|
|
1095
|
+
*/
|
|
1096
|
+
toolStreaming: z3.boolean().optional(),
|
|
1097
|
+
/**
|
|
1098
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1099
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1100
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1101
|
+
*
|
|
1102
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1103
|
+
*/
|
|
1104
|
+
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1105
|
+
/**
|
|
1106
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1107
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
1108
|
+
* gracefully as the budget is consumed.
|
|
1109
|
+
*
|
|
1110
|
+
* Advisory only — does not enforce a hard token limit.
|
|
1111
|
+
*/
|
|
1112
|
+
taskBudget: z3.object({
|
|
1113
|
+
type: z3.literal("tokens"),
|
|
1114
|
+
total: z3.number().int().min(2e4),
|
|
1115
|
+
remaining: z3.number().int().min(0).optional()
|
|
1116
|
+
}).optional(),
|
|
1117
|
+
/**
|
|
1118
|
+
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1119
|
+
* Only supported with claude-opus-4-6.
|
|
1120
|
+
*/
|
|
1121
|
+
speed: z3.enum(["fast", "standard"]).optional(),
|
|
1122
|
+
/**
|
|
1123
|
+
* Controls where model inference runs for this request.
|
|
1124
|
+
*
|
|
1125
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
1126
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1127
|
+
*
|
|
1128
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1129
|
+
*/
|
|
1130
|
+
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
1131
|
+
/**
|
|
1132
|
+
* Server-side fallback configuration.
|
|
1133
|
+
*
|
|
1134
|
+
* When the primary model's safety classifiers block a turn, the API
|
|
1135
|
+
* automatically retries it server-side on a fallback model. A
|
|
1136
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1137
|
+
*
|
|
1138
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1139
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
1140
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1141
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1142
|
+
* request as a direct request to that entry's model, so it must be
|
|
1143
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
1144
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1145
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1146
|
+
* beta). The value is passed through to the API as-is, and the
|
|
1147
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1148
|
+
*/
|
|
1149
|
+
fallbacks: z3.union([
|
|
1150
|
+
z3.literal("default"),
|
|
1151
|
+
z3.array(
|
|
1152
|
+
z3.object({
|
|
1153
|
+
model: z3.string(),
|
|
1154
|
+
max_tokens: z3.number().int().optional(),
|
|
1155
|
+
thinking: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1156
|
+
output_config: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1157
|
+
speed: z3.enum(["fast", "standard"]).optional()
|
|
1158
|
+
})
|
|
1159
|
+
)
|
|
1160
|
+
]).optional(),
|
|
1161
|
+
/**
|
|
1162
|
+
* A set of beta features to enable.
|
|
1163
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1164
|
+
*/
|
|
1165
|
+
anthropicBeta: z3.array(z3.string()).optional(),
|
|
1166
|
+
/**
|
|
1167
|
+
* Server-side safeguards to run as part of the request.
|
|
1168
|
+
*
|
|
1169
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1170
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1171
|
+
* relies on). The per-call verdicts are returned in
|
|
1172
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1173
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1174
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1175
|
+
*/
|
|
1176
|
+
safeguards: z3.array(
|
|
1177
|
+
z3.object({
|
|
1178
|
+
type: z3.literal("dangerous_tool_use"),
|
|
1179
|
+
classifierContext: z3.record(z3.string(), z3.unknown()).optional()
|
|
1180
|
+
})
|
|
1181
|
+
).optional(),
|
|
1182
|
+
contextManagement: z3.object({
|
|
1183
|
+
edits: z3.array(
|
|
1184
|
+
z3.discriminatedUnion("type", [
|
|
1174
1185
|
z3.object({
|
|
1175
|
-
type: z3.literal("
|
|
1176
|
-
|
|
1186
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
1187
|
+
trigger: z3.discriminatedUnion("type", [
|
|
1188
|
+
z3.object({
|
|
1189
|
+
type: z3.literal("input_tokens"),
|
|
1190
|
+
value: z3.number()
|
|
1191
|
+
}),
|
|
1192
|
+
z3.object({
|
|
1193
|
+
type: z3.literal("tool_uses"),
|
|
1194
|
+
value: z3.number()
|
|
1195
|
+
})
|
|
1196
|
+
]).optional(),
|
|
1197
|
+
keep: z3.object({
|
|
1198
|
+
type: z3.literal("tool_uses"),
|
|
1199
|
+
value: z3.number()
|
|
1200
|
+
}).optional(),
|
|
1201
|
+
clearAtLeast: z3.object({
|
|
1202
|
+
type: z3.literal("input_tokens"),
|
|
1203
|
+
value: z3.number()
|
|
1204
|
+
}).optional(),
|
|
1205
|
+
clearToolInputs: z3.boolean().optional(),
|
|
1206
|
+
excludeTools: z3.array(z3.string()).optional()
|
|
1177
1207
|
}),
|
|
1178
1208
|
z3.object({
|
|
1179
|
-
type: z3.literal("
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
type: z3.literal("input_tokens"),
|
|
1189
|
-
value: z3.number()
|
|
1190
|
-
}).optional(),
|
|
1191
|
-
clearToolInputs: z3.boolean().optional(),
|
|
1192
|
-
excludeTools: z3.array(z3.string()).optional()
|
|
1193
|
-
}),
|
|
1194
|
-
z3.object({
|
|
1195
|
-
type: z3.literal("clear_thinking_20251015"),
|
|
1196
|
-
keep: z3.union([
|
|
1197
|
-
z3.literal("all"),
|
|
1209
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
1210
|
+
keep: z3.union([
|
|
1211
|
+
z3.literal("all"),
|
|
1212
|
+
z3.object({
|
|
1213
|
+
type: z3.literal("thinking_turns"),
|
|
1214
|
+
value: z3.number()
|
|
1215
|
+
})
|
|
1216
|
+
]).optional()
|
|
1217
|
+
}),
|
|
1198
1218
|
z3.object({
|
|
1199
|
-
type: z3.literal("
|
|
1200
|
-
|
|
1219
|
+
type: z3.literal("compact_20260112"),
|
|
1220
|
+
trigger: z3.object({
|
|
1221
|
+
type: z3.literal("input_tokens"),
|
|
1222
|
+
value: z3.number()
|
|
1223
|
+
}).optional(),
|
|
1224
|
+
pauseAfterCompaction: z3.boolean().optional(),
|
|
1225
|
+
instructions: z3.string().optional()
|
|
1201
1226
|
})
|
|
1202
|
-
])
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
type: z3.literal("input_tokens"),
|
|
1208
|
-
value: z3.number()
|
|
1209
|
-
}).optional(),
|
|
1210
|
-
pauseAfterCompaction: z3.boolean().optional(),
|
|
1211
|
-
instructions: z3.string().optional()
|
|
1212
|
-
})
|
|
1213
|
-
])
|
|
1214
|
-
)
|
|
1215
|
-
}).optional()
|
|
1227
|
+
])
|
|
1228
|
+
)
|
|
1229
|
+
}).optional()
|
|
1230
|
+
})
|
|
1231
|
+
);
|
|
1216
1232
|
});
|
|
1217
1233
|
|
|
1218
1234
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1222,19 +1238,24 @@ import {
|
|
|
1222
1238
|
|
|
1223
1239
|
// src/get-cache-control.ts
|
|
1224
1240
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
1225
|
-
function getCacheControl(providerMetadata) {
|
|
1226
|
-
var _a;
|
|
1241
|
+
function getCacheControl(providerMetadata, providerOptionsName) {
|
|
1242
|
+
var _a, _b, _c;
|
|
1243
|
+
const custom = providerMetadata == null ? void 0 : providerMetadata[providerOptionsName];
|
|
1227
1244
|
const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
1228
|
-
const cacheControlValue = (_a = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ?
|
|
1245
|
+
const cacheControlValue = (_c = (_b = (_a = custom == null ? void 0 : custom.cacheControl) != null ? _a : custom == null ? void 0 : custom.cache_control) != null ? _b : anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _c : anthropic2 == null ? void 0 : anthropic2.cache_control;
|
|
1229
1246
|
return cacheControlValue;
|
|
1230
1247
|
}
|
|
1231
1248
|
var CacheControlValidator = class {
|
|
1232
|
-
constructor() {
|
|
1249
|
+
constructor(providerOptionsName = "anthropic") {
|
|
1250
|
+
this.providerOptionsName = providerOptionsName;
|
|
1233
1251
|
this.breakpointCount = 0;
|
|
1234
1252
|
this.warnings = [];
|
|
1235
1253
|
}
|
|
1236
1254
|
getCacheControl(providerMetadata, context) {
|
|
1237
|
-
const cacheControlValue = getCacheControl(
|
|
1255
|
+
const cacheControlValue = getCacheControl(
|
|
1256
|
+
providerMetadata,
|
|
1257
|
+
this.providerOptionsName
|
|
1258
|
+
);
|
|
1238
1259
|
if (!cacheControlValue) {
|
|
1239
1260
|
return void 0;
|
|
1240
1261
|
}
|
|
@@ -1265,12 +1286,12 @@ var CacheControlValidator = class {
|
|
|
1265
1286
|
// src/tool/advisor_20260301.ts
|
|
1266
1287
|
import {
|
|
1267
1288
|
createProviderToolFactoryWithOutputSchema,
|
|
1268
|
-
lazySchema as
|
|
1269
|
-
zodSchema as
|
|
1289
|
+
lazySchema as lazySchema4,
|
|
1290
|
+
zodSchema as zodSchema4
|
|
1270
1291
|
} from "@ai-sdk/provider-utils";
|
|
1271
1292
|
import { z as z4 } from "zod/v4";
|
|
1272
|
-
var advisor_20260301ArgsSchema =
|
|
1273
|
-
() =>
|
|
1293
|
+
var advisor_20260301ArgsSchema = lazySchema4(
|
|
1294
|
+
() => zodSchema4(
|
|
1274
1295
|
z4.object({
|
|
1275
1296
|
model: z4.string(),
|
|
1276
1297
|
maxUses: z4.number().optional(),
|
|
@@ -1281,8 +1302,8 @@ var advisor_20260301ArgsSchema = lazySchema3(
|
|
|
1281
1302
|
})
|
|
1282
1303
|
)
|
|
1283
1304
|
);
|
|
1284
|
-
var advisor_20260301OutputSchema =
|
|
1285
|
-
() =>
|
|
1305
|
+
var advisor_20260301OutputSchema = lazySchema4(
|
|
1306
|
+
() => zodSchema4(
|
|
1286
1307
|
z4.discriminatedUnion("type", [
|
|
1287
1308
|
z4.object({
|
|
1288
1309
|
type: z4.literal("advisor_result"),
|
|
@@ -1299,8 +1320,8 @@ var advisor_20260301OutputSchema = lazySchema3(
|
|
|
1299
1320
|
])
|
|
1300
1321
|
)
|
|
1301
1322
|
);
|
|
1302
|
-
var advisor_20260301InputSchema =
|
|
1303
|
-
() =>
|
|
1323
|
+
var advisor_20260301InputSchema = lazySchema4(
|
|
1324
|
+
() => zodSchema4(z4.object({}).strict())
|
|
1304
1325
|
);
|
|
1305
1326
|
var factory = createProviderToolFactoryWithOutputSchema({
|
|
1306
1327
|
id: "anthropic.advisor_20260301",
|
|
@@ -1315,8 +1336,8 @@ var advisor_20260301 = (args) => {
|
|
|
1315
1336
|
// src/tool/computer-toolset_20260801.ts
|
|
1316
1337
|
import {
|
|
1317
1338
|
createProviderToolFactory,
|
|
1318
|
-
lazySchema as
|
|
1319
|
-
zodSchema as
|
|
1339
|
+
lazySchema as lazySchema5,
|
|
1340
|
+
zodSchema as zodSchema5
|
|
1320
1341
|
} from "@ai-sdk/provider-utils";
|
|
1321
1342
|
import { z as z5 } from "zod/v4";
|
|
1322
1343
|
var computerToolset_20260801Members = [
|
|
@@ -1338,8 +1359,8 @@ var computerToolset_20260801Members = [
|
|
|
1338
1359
|
"hold_key",
|
|
1339
1360
|
"wait"
|
|
1340
1361
|
];
|
|
1341
|
-
var computerToolset_20260801InputSchema =
|
|
1342
|
-
() =>
|
|
1362
|
+
var computerToolset_20260801InputSchema = lazySchema5(
|
|
1363
|
+
() => zodSchema5(
|
|
1343
1364
|
z5.object({
|
|
1344
1365
|
action: z5.enum(computerToolset_20260801Members),
|
|
1345
1366
|
coordinate: z5.tuple([z5.number().int(), z5.number().int()]).optional(),
|
|
@@ -1358,8 +1379,8 @@ var computerToolset_20260801InputSchema = lazySchema4(
|
|
|
1358
1379
|
})
|
|
1359
1380
|
)
|
|
1360
1381
|
);
|
|
1361
|
-
var computerToolset_20260801ArgsSchema =
|
|
1362
|
-
() =>
|
|
1382
|
+
var computerToolset_20260801ArgsSchema = lazySchema5(
|
|
1383
|
+
() => zodSchema5(
|
|
1363
1384
|
z5.object({
|
|
1364
1385
|
configs: z5.partialRecord(
|
|
1365
1386
|
z5.enum(computerToolset_20260801Members),
|
|
@@ -1379,19 +1400,19 @@ var computerToolset_20260801 = createProviderToolFactory({
|
|
|
1379
1400
|
// src/tool/text-editor_20250728.ts
|
|
1380
1401
|
import {
|
|
1381
1402
|
createProviderToolFactory as createProviderToolFactory2,
|
|
1382
|
-
lazySchema as
|
|
1383
|
-
zodSchema as
|
|
1403
|
+
lazySchema as lazySchema6,
|
|
1404
|
+
zodSchema as zodSchema6
|
|
1384
1405
|
} from "@ai-sdk/provider-utils";
|
|
1385
1406
|
import { z as z6 } from "zod/v4";
|
|
1386
|
-
var textEditor_20250728ArgsSchema =
|
|
1387
|
-
() =>
|
|
1407
|
+
var textEditor_20250728ArgsSchema = lazySchema6(
|
|
1408
|
+
() => zodSchema6(
|
|
1388
1409
|
z6.object({
|
|
1389
1410
|
maxCharacters: z6.number().optional()
|
|
1390
1411
|
})
|
|
1391
1412
|
)
|
|
1392
1413
|
);
|
|
1393
|
-
var textEditor_20250728InputSchema =
|
|
1394
|
-
() =>
|
|
1414
|
+
var textEditor_20250728InputSchema = lazySchema6(
|
|
1415
|
+
() => zodSchema6(
|
|
1395
1416
|
z6.object({
|
|
1396
1417
|
command: z6.enum(["view", "create", "str_replace", "insert"]),
|
|
1397
1418
|
path: z6.string(),
|
|
@@ -1415,12 +1436,12 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1415
1436
|
// src/tool/web-search_20260209.ts
|
|
1416
1437
|
import {
|
|
1417
1438
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1418
|
-
lazySchema as
|
|
1419
|
-
zodSchema as
|
|
1439
|
+
lazySchema as lazySchema7,
|
|
1440
|
+
zodSchema as zodSchema7
|
|
1420
1441
|
} from "@ai-sdk/provider-utils";
|
|
1421
1442
|
import { z as z7 } from "zod/v4";
|
|
1422
|
-
var webSearch_20260209ArgsSchema =
|
|
1423
|
-
() =>
|
|
1443
|
+
var webSearch_20260209ArgsSchema = lazySchema7(
|
|
1444
|
+
() => zodSchema7(
|
|
1424
1445
|
z7.object({
|
|
1425
1446
|
maxUses: z7.number().optional(),
|
|
1426
1447
|
allowedDomains: z7.array(z7.string()).optional(),
|
|
@@ -1435,8 +1456,8 @@ var webSearch_20260209ArgsSchema = lazySchema6(
|
|
|
1435
1456
|
})
|
|
1436
1457
|
)
|
|
1437
1458
|
);
|
|
1438
|
-
var webSearch_20260209OutputSchema =
|
|
1439
|
-
() =>
|
|
1459
|
+
var webSearch_20260209OutputSchema = lazySchema7(
|
|
1460
|
+
() => zodSchema7(
|
|
1440
1461
|
z7.array(
|
|
1441
1462
|
z7.object({
|
|
1442
1463
|
url: z7.string(),
|
|
@@ -1448,8 +1469,8 @@ var webSearch_20260209OutputSchema = lazySchema6(
|
|
|
1448
1469
|
)
|
|
1449
1470
|
)
|
|
1450
1471
|
);
|
|
1451
|
-
var webSearch_20260209InputSchema =
|
|
1452
|
-
() =>
|
|
1472
|
+
var webSearch_20260209InputSchema = lazySchema7(
|
|
1473
|
+
() => zodSchema7(
|
|
1453
1474
|
z7.object({
|
|
1454
1475
|
query: z7.string()
|
|
1455
1476
|
})
|
|
@@ -1468,12 +1489,12 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1468
1489
|
// src/tool/web-search_20250305.ts
|
|
1469
1490
|
import {
|
|
1470
1491
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1471
|
-
lazySchema as
|
|
1472
|
-
zodSchema as
|
|
1492
|
+
lazySchema as lazySchema8,
|
|
1493
|
+
zodSchema as zodSchema8
|
|
1473
1494
|
} from "@ai-sdk/provider-utils";
|
|
1474
1495
|
import { z as z8 } from "zod/v4";
|
|
1475
|
-
var webSearch_20250305ArgsSchema =
|
|
1476
|
-
() =>
|
|
1496
|
+
var webSearch_20250305ArgsSchema = lazySchema8(
|
|
1497
|
+
() => zodSchema8(
|
|
1477
1498
|
z8.object({
|
|
1478
1499
|
maxUses: z8.number().optional(),
|
|
1479
1500
|
allowedDomains: z8.array(z8.string()).optional(),
|
|
@@ -1488,8 +1509,8 @@ var webSearch_20250305ArgsSchema = lazySchema7(
|
|
|
1488
1509
|
})
|
|
1489
1510
|
)
|
|
1490
1511
|
);
|
|
1491
|
-
var webSearch_20250305OutputSchema =
|
|
1492
|
-
() =>
|
|
1512
|
+
var webSearch_20250305OutputSchema = lazySchema8(
|
|
1513
|
+
() => zodSchema8(
|
|
1493
1514
|
z8.array(
|
|
1494
1515
|
z8.object({
|
|
1495
1516
|
url: z8.string(),
|
|
@@ -1501,8 +1522,8 @@ var webSearch_20250305OutputSchema = lazySchema7(
|
|
|
1501
1522
|
)
|
|
1502
1523
|
)
|
|
1503
1524
|
);
|
|
1504
|
-
var webSearch_20250305InputSchema =
|
|
1505
|
-
() =>
|
|
1525
|
+
var webSearch_20250305InputSchema = lazySchema8(
|
|
1526
|
+
() => zodSchema8(
|
|
1506
1527
|
z8.object({
|
|
1507
1528
|
query: z8.string()
|
|
1508
1529
|
})
|
|
@@ -1521,12 +1542,12 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1521
1542
|
// src/tool/web-fetch-20260209.ts
|
|
1522
1543
|
import {
|
|
1523
1544
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1524
|
-
lazySchema as
|
|
1525
|
-
zodSchema as
|
|
1545
|
+
lazySchema as lazySchema9,
|
|
1546
|
+
zodSchema as zodSchema9
|
|
1526
1547
|
} from "@ai-sdk/provider-utils";
|
|
1527
1548
|
import { z as z9 } from "zod/v4";
|
|
1528
|
-
var webFetch_20260209ArgsSchema =
|
|
1529
|
-
() =>
|
|
1549
|
+
var webFetch_20260209ArgsSchema = lazySchema9(
|
|
1550
|
+
() => zodSchema9(
|
|
1530
1551
|
z9.object({
|
|
1531
1552
|
maxUses: z9.number().optional(),
|
|
1532
1553
|
allowedDomains: z9.array(z9.string()).optional(),
|
|
@@ -1536,8 +1557,8 @@ var webFetch_20260209ArgsSchema = lazySchema8(
|
|
|
1536
1557
|
})
|
|
1537
1558
|
)
|
|
1538
1559
|
);
|
|
1539
|
-
var webFetch_20260209OutputSchema =
|
|
1540
|
-
() =>
|
|
1560
|
+
var webFetch_20260209OutputSchema = lazySchema9(
|
|
1561
|
+
() => zodSchema9(
|
|
1541
1562
|
z9.object({
|
|
1542
1563
|
type: z9.literal("web_fetch_result"),
|
|
1543
1564
|
url: z9.string(),
|
|
@@ -1562,8 +1583,8 @@ var webFetch_20260209OutputSchema = lazySchema8(
|
|
|
1562
1583
|
})
|
|
1563
1584
|
)
|
|
1564
1585
|
);
|
|
1565
|
-
var webFetch_20260209InputSchema =
|
|
1566
|
-
() =>
|
|
1586
|
+
var webFetch_20260209InputSchema = lazySchema9(
|
|
1587
|
+
() => zodSchema9(
|
|
1567
1588
|
z9.object({
|
|
1568
1589
|
url: z9.string()
|
|
1569
1590
|
})
|
|
@@ -1582,12 +1603,12 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1582
1603
|
// src/tool/web-fetch-20250910.ts
|
|
1583
1604
|
import {
|
|
1584
1605
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1585
|
-
lazySchema as
|
|
1586
|
-
zodSchema as
|
|
1606
|
+
lazySchema as lazySchema10,
|
|
1607
|
+
zodSchema as zodSchema10
|
|
1587
1608
|
} from "@ai-sdk/provider-utils";
|
|
1588
1609
|
import { z as z10 } from "zod/v4";
|
|
1589
|
-
var webFetch_20250910ArgsSchema =
|
|
1590
|
-
() =>
|
|
1610
|
+
var webFetch_20250910ArgsSchema = lazySchema10(
|
|
1611
|
+
() => zodSchema10(
|
|
1591
1612
|
z10.object({
|
|
1592
1613
|
maxUses: z10.number().optional(),
|
|
1593
1614
|
allowedDomains: z10.array(z10.string()).optional(),
|
|
@@ -1597,8 +1618,8 @@ var webFetch_20250910ArgsSchema = lazySchema9(
|
|
|
1597
1618
|
})
|
|
1598
1619
|
)
|
|
1599
1620
|
);
|
|
1600
|
-
var webFetch_20250910OutputSchema =
|
|
1601
|
-
() =>
|
|
1621
|
+
var webFetch_20250910OutputSchema = lazySchema10(
|
|
1622
|
+
() => zodSchema10(
|
|
1602
1623
|
z10.object({
|
|
1603
1624
|
type: z10.literal("web_fetch_result"),
|
|
1604
1625
|
url: z10.string(),
|
|
@@ -1623,8 +1644,8 @@ var webFetch_20250910OutputSchema = lazySchema9(
|
|
|
1623
1644
|
})
|
|
1624
1645
|
)
|
|
1625
1646
|
);
|
|
1626
|
-
var webFetch_20250910InputSchema =
|
|
1627
|
-
() =>
|
|
1647
|
+
var webFetch_20250910InputSchema = lazySchema10(
|
|
1648
|
+
() => zodSchema10(
|
|
1628
1649
|
z10.object({
|
|
1629
1650
|
url: z10.string()
|
|
1630
1651
|
})
|
|
@@ -2133,12 +2154,12 @@ import {
|
|
|
2133
2154
|
// src/tool/code-execution_20250522.ts
|
|
2134
2155
|
import {
|
|
2135
2156
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
2136
|
-
lazySchema as
|
|
2137
|
-
zodSchema as
|
|
2157
|
+
lazySchema as lazySchema11,
|
|
2158
|
+
zodSchema as zodSchema11
|
|
2138
2159
|
} from "@ai-sdk/provider-utils";
|
|
2139
2160
|
import { z as z11 } from "zod/v4";
|
|
2140
|
-
var codeExecution_20250522OutputSchema =
|
|
2141
|
-
() =>
|
|
2161
|
+
var codeExecution_20250522OutputSchema = lazySchema11(
|
|
2162
|
+
() => zodSchema11(
|
|
2142
2163
|
z11.object({
|
|
2143
2164
|
type: z11.literal("code_execution_result"),
|
|
2144
2165
|
stdout: z11.string(),
|
|
@@ -2153,8 +2174,8 @@ var codeExecution_20250522OutputSchema = lazySchema10(
|
|
|
2153
2174
|
})
|
|
2154
2175
|
)
|
|
2155
2176
|
);
|
|
2156
|
-
var codeExecution_20250522InputSchema =
|
|
2157
|
-
() =>
|
|
2177
|
+
var codeExecution_20250522InputSchema = lazySchema11(
|
|
2178
|
+
() => zodSchema11(
|
|
2158
2179
|
z11.object({
|
|
2159
2180
|
code: z11.string()
|
|
2160
2181
|
})
|
|
@@ -2172,12 +2193,12 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2172
2193
|
// src/tool/code-execution_20250825.ts
|
|
2173
2194
|
import {
|
|
2174
2195
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
2175
|
-
lazySchema as
|
|
2176
|
-
zodSchema as
|
|
2196
|
+
lazySchema as lazySchema12,
|
|
2197
|
+
zodSchema as zodSchema12
|
|
2177
2198
|
} from "@ai-sdk/provider-utils";
|
|
2178
2199
|
import { z as z12 } from "zod/v4";
|
|
2179
|
-
var codeExecution_20250825OutputSchema =
|
|
2180
|
-
() =>
|
|
2200
|
+
var codeExecution_20250825OutputSchema = lazySchema12(
|
|
2201
|
+
() => zodSchema12(
|
|
2181
2202
|
z12.discriminatedUnion("type", [
|
|
2182
2203
|
z12.object({
|
|
2183
2204
|
type: z12.literal("code_execution_result"),
|
|
@@ -2234,8 +2255,8 @@ var codeExecution_20250825OutputSchema = lazySchema11(
|
|
|
2234
2255
|
])
|
|
2235
2256
|
)
|
|
2236
2257
|
);
|
|
2237
|
-
var codeExecution_20250825InputSchema =
|
|
2238
|
-
() =>
|
|
2258
|
+
var codeExecution_20250825InputSchema = lazySchema12(
|
|
2259
|
+
() => zodSchema12(
|
|
2239
2260
|
z12.discriminatedUnion("type", [
|
|
2240
2261
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2241
2262
|
z12.object({
|
|
@@ -2285,12 +2306,12 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2285
2306
|
// src/tool/code-execution_20260120.ts
|
|
2286
2307
|
import {
|
|
2287
2308
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2288
|
-
lazySchema as
|
|
2289
|
-
zodSchema as
|
|
2309
|
+
lazySchema as lazySchema13,
|
|
2310
|
+
zodSchema as zodSchema13
|
|
2290
2311
|
} from "@ai-sdk/provider-utils";
|
|
2291
2312
|
import { z as z13 } from "zod/v4";
|
|
2292
|
-
var codeExecution_20260120OutputSchema =
|
|
2293
|
-
() =>
|
|
2313
|
+
var codeExecution_20260120OutputSchema = lazySchema13(
|
|
2314
|
+
() => zodSchema13(
|
|
2294
2315
|
z13.discriminatedUnion("type", [
|
|
2295
2316
|
z13.object({
|
|
2296
2317
|
type: z13.literal("code_execution_result"),
|
|
@@ -2359,8 +2380,8 @@ var codeExecution_20260120OutputSchema = lazySchema12(
|
|
|
2359
2380
|
])
|
|
2360
2381
|
)
|
|
2361
2382
|
);
|
|
2362
|
-
var codeExecution_20260120InputSchema =
|
|
2363
|
-
() =>
|
|
2383
|
+
var codeExecution_20260120InputSchema = lazySchema13(
|
|
2384
|
+
() => zodSchema13(
|
|
2364
2385
|
z13.discriminatedUnion("type", [
|
|
2365
2386
|
z13.object({
|
|
2366
2387
|
type: z13.literal("programmatic-tool-call"),
|
|
@@ -2406,12 +2427,12 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2406
2427
|
// src/tool/tool-search-regex_20251119.ts
|
|
2407
2428
|
import {
|
|
2408
2429
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2409
|
-
lazySchema as
|
|
2410
|
-
zodSchema as
|
|
2430
|
+
lazySchema as lazySchema14,
|
|
2431
|
+
zodSchema as zodSchema14
|
|
2411
2432
|
} from "@ai-sdk/provider-utils";
|
|
2412
2433
|
import { z as z14 } from "zod/v4";
|
|
2413
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
2414
|
-
() =>
|
|
2434
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema14(
|
|
2435
|
+
() => zodSchema14(
|
|
2415
2436
|
z14.array(
|
|
2416
2437
|
z14.object({
|
|
2417
2438
|
type: z14.literal("tool_reference"),
|
|
@@ -2420,8 +2441,8 @@ var toolSearchRegex_20251119OutputSchema = lazySchema13(
|
|
|
2420
2441
|
)
|
|
2421
2442
|
)
|
|
2422
2443
|
);
|
|
2423
|
-
var toolSearchRegex_20251119InputSchema =
|
|
2424
|
-
() =>
|
|
2444
|
+
var toolSearchRegex_20251119InputSchema = lazySchema14(
|
|
2445
|
+
() => zodSchema14(
|
|
2425
2446
|
z14.object({
|
|
2426
2447
|
/**
|
|
2427
2448
|
* A regex pattern to search for tools.
|
|
@@ -2498,7 +2519,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2498
2519
|
warnings,
|
|
2499
2520
|
cacheControlValidator,
|
|
2500
2521
|
toolNameMapping,
|
|
2501
|
-
toolsetNames = {}
|
|
2522
|
+
toolsetNames = {},
|
|
2523
|
+
convertMediaPart
|
|
2502
2524
|
}) {
|
|
2503
2525
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2504
2526
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2641,6 +2663,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2641
2663
|
break;
|
|
2642
2664
|
}
|
|
2643
2665
|
case "file": {
|
|
2666
|
+
const customContent = await (convertMediaPart == null ? void 0 : convertMediaPart(part));
|
|
2667
|
+
if (customContent != null) {
|
|
2668
|
+
anthropicContent.push({
|
|
2669
|
+
...customContent,
|
|
2670
|
+
cache_control: cacheControl
|
|
2671
|
+
});
|
|
2672
|
+
break;
|
|
2673
|
+
}
|
|
2644
2674
|
if (part.mediaType.startsWith("image/")) {
|
|
2645
2675
|
anthropicContent.push({
|
|
2646
2676
|
type: "image",
|
|
@@ -3837,7 +3867,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3837
3867
|
providerOptions,
|
|
3838
3868
|
stream
|
|
3839
3869
|
}) {
|
|
3840
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3870
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3841
3871
|
const warnings = [];
|
|
3842
3872
|
if (frequencyPenalty != null) {
|
|
3843
3873
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3848,18 +3878,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3848
3878
|
if (seed != null) {
|
|
3849
3879
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
3850
3880
|
}
|
|
3851
|
-
|
|
3881
|
+
const maxTemperature = (_a = this.config.maxTemperature) != null ? _a : 1;
|
|
3882
|
+
const temperatureProvider = this.config.maxTemperature == null ? "anthropic" : this.providerOptionsName;
|
|
3883
|
+
if (temperature != null && temperature > maxTemperature) {
|
|
3852
3884
|
warnings.push({
|
|
3853
3885
|
type: "unsupported",
|
|
3854
3886
|
feature: "temperature",
|
|
3855
|
-
details: `${temperature} exceeds
|
|
3887
|
+
details: `${temperature} exceeds ${temperatureProvider} maximum of ${maxTemperature.toFixed(1)}. clamped to ${maxTemperature.toFixed(1)}`
|
|
3856
3888
|
});
|
|
3857
|
-
temperature =
|
|
3889
|
+
temperature = maxTemperature;
|
|
3858
3890
|
} else if (temperature != null && temperature < 0) {
|
|
3859
3891
|
warnings.push({
|
|
3860
3892
|
type: "unsupported",
|
|
3861
3893
|
feature: "temperature",
|
|
3862
|
-
details: `${temperature} is below
|
|
3894
|
+
details: `${temperature} is below ${temperatureProvider} minimum of 0. clamped to 0`
|
|
3863
3895
|
});
|
|
3864
3896
|
temperature = 0;
|
|
3865
3897
|
}
|
|
@@ -3934,9 +3966,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3934
3966
|
}
|
|
3935
3967
|
}
|
|
3936
3968
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3937
|
-
const supportsStructuredOutput = ((
|
|
3938
|
-
const supportsStrictTools = ((
|
|
3939
|
-
const structureOutputMode = (
|
|
3969
|
+
const supportsStructuredOutput = ((_b = this.config.supportsNativeStructuredOutput) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3970
|
+
const supportsStrictTools = ((_c = this.config.supportsStrictTools) != null ? _c : true) && modelSupportsStructuredOutput;
|
|
3971
|
+
const structureOutputMode = (_d = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _d : "auto";
|
|
3940
3972
|
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3941
3973
|
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3942
3974
|
warnings.push({
|
|
@@ -3960,7 +3992,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3960
3992
|
});
|
|
3961
3993
|
}
|
|
3962
3994
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3963
|
-
const cacheControlValidator = new CacheControlValidator(
|
|
3995
|
+
const cacheControlValidator = new CacheControlValidator(
|
|
3996
|
+
this.config.cacheControlProviderOptionsName
|
|
3997
|
+
);
|
|
3964
3998
|
const toolNameMapping = createToolNameMapping({
|
|
3965
3999
|
tools,
|
|
3966
4000
|
providerToolNames: {
|
|
@@ -3990,11 +4024,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3990
4024
|
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3991
4025
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3992
4026
|
prompt,
|
|
3993
|
-
sendReasoning: (
|
|
4027
|
+
sendReasoning: (_e = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _e : true,
|
|
3994
4028
|
warnings,
|
|
3995
4029
|
cacheControlValidator,
|
|
3996
4030
|
toolNameMapping,
|
|
3997
|
-
toolsetNames
|
|
4031
|
+
toolsetNames,
|
|
4032
|
+
convertMediaPart: this.config.convertMediaPart
|
|
3998
4033
|
});
|
|
3999
4034
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
4000
4035
|
const requestedThinking = anthropicOptions.thinking;
|
|
@@ -4104,7 +4139,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4104
4139
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
4105
4140
|
cache_control: anthropicOptions.cacheControl
|
|
4106
4141
|
},
|
|
4107
|
-
...((
|
|
4142
|
+
...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
|
|
4108
4143
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
4109
4144
|
},
|
|
4110
4145
|
// mcp servers:
|
|
@@ -4212,7 +4247,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4212
4247
|
};
|
|
4213
4248
|
thinkingBudget = 1024;
|
|
4214
4249
|
}
|
|
4215
|
-
if (baseArgs.temperature != null) {
|
|
4250
|
+
if (baseArgs.temperature != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4216
4251
|
baseArgs.temperature = void 0;
|
|
4217
4252
|
warnings.push({
|
|
4218
4253
|
type: "unsupported",
|
|
@@ -4228,7 +4263,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4228
4263
|
details: "topK is not supported when thinking is enabled"
|
|
4229
4264
|
});
|
|
4230
4265
|
}
|
|
4231
|
-
if (topP != null) {
|
|
4266
|
+
if (topP != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4232
4267
|
baseArgs.top_p = void 0;
|
|
4233
4268
|
warnings.push({
|
|
4234
4269
|
type: "unsupported",
|
|
@@ -4299,7 +4334,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4299
4334
|
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
4300
4335
|
betas.add("server-side-fallback-2026-06-01");
|
|
4301
4336
|
}
|
|
4302
|
-
const defaultEagerInputStreaming = stream && ((
|
|
4337
|
+
const defaultEagerInputStreaming = stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true);
|
|
4303
4338
|
const {
|
|
4304
4339
|
tools: anthropicTools2,
|
|
4305
4340
|
toolChoice: anthropicToolChoice,
|
|
@@ -4340,7 +4375,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4340
4375
|
...betas,
|
|
4341
4376
|
...toolsBetas,
|
|
4342
4377
|
...userSuppliedBetas,
|
|
4343
|
-
...(
|
|
4378
|
+
...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
|
|
4344
4379
|
]),
|
|
4345
4380
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
4346
4381
|
toolNameMapping,
|
|
@@ -6146,12 +6181,12 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6146
6181
|
// src/tool/bash_20241022.ts
|
|
6147
6182
|
import {
|
|
6148
6183
|
createProviderToolFactory as createProviderToolFactory3,
|
|
6149
|
-
lazySchema as
|
|
6150
|
-
zodSchema as
|
|
6184
|
+
lazySchema as lazySchema15,
|
|
6185
|
+
zodSchema as zodSchema15
|
|
6151
6186
|
} from "@ai-sdk/provider-utils";
|
|
6152
6187
|
import { z as z15 } from "zod/v4";
|
|
6153
|
-
var bash_20241022InputSchema =
|
|
6154
|
-
() =>
|
|
6188
|
+
var bash_20241022InputSchema = lazySchema15(
|
|
6189
|
+
() => zodSchema15(
|
|
6155
6190
|
z15.object({
|
|
6156
6191
|
command: z15.string(),
|
|
6157
6192
|
restart: z15.boolean().optional()
|
|
@@ -6166,12 +6201,12 @@ var bash_20241022 = createProviderToolFactory3({
|
|
|
6166
6201
|
// src/tool/bash_20250124.ts
|
|
6167
6202
|
import {
|
|
6168
6203
|
createProviderToolFactory as createProviderToolFactory4,
|
|
6169
|
-
lazySchema as
|
|
6170
|
-
zodSchema as
|
|
6204
|
+
lazySchema as lazySchema16,
|
|
6205
|
+
zodSchema as zodSchema16
|
|
6171
6206
|
} from "@ai-sdk/provider-utils";
|
|
6172
6207
|
import { z as z16 } from "zod/v4";
|
|
6173
|
-
var bash_20250124InputSchema =
|
|
6174
|
-
() =>
|
|
6208
|
+
var bash_20250124InputSchema = lazySchema16(
|
|
6209
|
+
() => zodSchema16(
|
|
6175
6210
|
z16.object({
|
|
6176
6211
|
command: z16.string(),
|
|
6177
6212
|
restart: z16.boolean().optional()
|
|
@@ -6186,12 +6221,12 @@ var bash_20250124 = createProviderToolFactory4({
|
|
|
6186
6221
|
// src/tool/computer_20241022.ts
|
|
6187
6222
|
import {
|
|
6188
6223
|
createProviderToolFactory as createProviderToolFactory5,
|
|
6189
|
-
lazySchema as
|
|
6190
|
-
zodSchema as
|
|
6224
|
+
lazySchema as lazySchema17,
|
|
6225
|
+
zodSchema as zodSchema17
|
|
6191
6226
|
} from "@ai-sdk/provider-utils";
|
|
6192
6227
|
import { z as z17 } from "zod/v4";
|
|
6193
|
-
var computer_20241022InputSchema =
|
|
6194
|
-
() =>
|
|
6228
|
+
var computer_20241022InputSchema = lazySchema17(
|
|
6229
|
+
() => zodSchema17(
|
|
6195
6230
|
z17.object({
|
|
6196
6231
|
action: z17.enum([
|
|
6197
6232
|
"key",
|
|
@@ -6218,12 +6253,12 @@ var computer_20241022 = createProviderToolFactory5({
|
|
|
6218
6253
|
// src/tool/computer_20250124.ts
|
|
6219
6254
|
import {
|
|
6220
6255
|
createProviderToolFactory as createProviderToolFactory6,
|
|
6221
|
-
lazySchema as
|
|
6222
|
-
zodSchema as
|
|
6256
|
+
lazySchema as lazySchema18,
|
|
6257
|
+
zodSchema as zodSchema18
|
|
6223
6258
|
} from "@ai-sdk/provider-utils";
|
|
6224
6259
|
import { z as z18 } from "zod/v4";
|
|
6225
|
-
var computer_20250124InputSchema =
|
|
6226
|
-
() =>
|
|
6260
|
+
var computer_20250124InputSchema = lazySchema18(
|
|
6261
|
+
() => zodSchema18(
|
|
6227
6262
|
z18.object({
|
|
6228
6263
|
action: z18.enum([
|
|
6229
6264
|
"key",
|
|
@@ -6260,12 +6295,12 @@ var computer_20250124 = createProviderToolFactory6({
|
|
|
6260
6295
|
// src/tool/computer_20251124.ts
|
|
6261
6296
|
import {
|
|
6262
6297
|
createProviderToolFactory as createProviderToolFactory7,
|
|
6263
|
-
lazySchema as
|
|
6264
|
-
zodSchema as
|
|
6298
|
+
lazySchema as lazySchema19,
|
|
6299
|
+
zodSchema as zodSchema19
|
|
6265
6300
|
} from "@ai-sdk/provider-utils";
|
|
6266
6301
|
import { z as z19 } from "zod/v4";
|
|
6267
|
-
var computer_20251124InputSchema =
|
|
6268
|
-
() =>
|
|
6302
|
+
var computer_20251124InputSchema = lazySchema19(
|
|
6303
|
+
() => zodSchema19(
|
|
6269
6304
|
z19.object({
|
|
6270
6305
|
action: z19.enum([
|
|
6271
6306
|
"key",
|
|
@@ -6309,12 +6344,12 @@ var computer_20251124 = createProviderToolFactory7({
|
|
|
6309
6344
|
// src/tool/memory_20250818.ts
|
|
6310
6345
|
import {
|
|
6311
6346
|
createProviderToolFactory as createProviderToolFactory8,
|
|
6312
|
-
lazySchema as
|
|
6313
|
-
zodSchema as
|
|
6347
|
+
lazySchema as lazySchema20,
|
|
6348
|
+
zodSchema as zodSchema20
|
|
6314
6349
|
} from "@ai-sdk/provider-utils";
|
|
6315
6350
|
import { z as z20 } from "zod/v4";
|
|
6316
|
-
var memory_20250818InputSchema =
|
|
6317
|
-
() =>
|
|
6351
|
+
var memory_20250818InputSchema = lazySchema20(
|
|
6352
|
+
() => zodSchema20(
|
|
6318
6353
|
z20.discriminatedUnion("command", [
|
|
6319
6354
|
z20.object({
|
|
6320
6355
|
command: z20.literal("view"),
|
|
@@ -6358,12 +6393,12 @@ var memory_20250818 = createProviderToolFactory8({
|
|
|
6358
6393
|
// src/tool/text-editor_20241022.ts
|
|
6359
6394
|
import {
|
|
6360
6395
|
createProviderToolFactory as createProviderToolFactory9,
|
|
6361
|
-
lazySchema as
|
|
6362
|
-
zodSchema as
|
|
6396
|
+
lazySchema as lazySchema21,
|
|
6397
|
+
zodSchema as zodSchema21
|
|
6363
6398
|
} from "@ai-sdk/provider-utils";
|
|
6364
6399
|
import { z as z21 } from "zod/v4";
|
|
6365
|
-
var textEditor_20241022InputSchema =
|
|
6366
|
-
() =>
|
|
6400
|
+
var textEditor_20241022InputSchema = lazySchema21(
|
|
6401
|
+
() => zodSchema21(
|
|
6367
6402
|
z21.object({
|
|
6368
6403
|
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6369
6404
|
path: z21.string(),
|
|
@@ -6384,12 +6419,12 @@ var textEditor_20241022 = createProviderToolFactory9({
|
|
|
6384
6419
|
// src/tool/text-editor_20250124.ts
|
|
6385
6420
|
import {
|
|
6386
6421
|
createProviderToolFactory as createProviderToolFactory10,
|
|
6387
|
-
lazySchema as
|
|
6388
|
-
zodSchema as
|
|
6422
|
+
lazySchema as lazySchema22,
|
|
6423
|
+
zodSchema as zodSchema22
|
|
6389
6424
|
} from "@ai-sdk/provider-utils";
|
|
6390
6425
|
import { z as z22 } from "zod/v4";
|
|
6391
|
-
var textEditor_20250124InputSchema =
|
|
6392
|
-
() =>
|
|
6426
|
+
var textEditor_20250124InputSchema = lazySchema22(
|
|
6427
|
+
() => zodSchema22(
|
|
6393
6428
|
z22.object({
|
|
6394
6429
|
command: z22.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6395
6430
|
path: z22.string(),
|
|
@@ -6410,12 +6445,12 @@ var textEditor_20250124 = createProviderToolFactory10({
|
|
|
6410
6445
|
// src/tool/text-editor_20250429.ts
|
|
6411
6446
|
import {
|
|
6412
6447
|
createProviderToolFactory as createProviderToolFactory11,
|
|
6413
|
-
lazySchema as
|
|
6414
|
-
zodSchema as
|
|
6448
|
+
lazySchema as lazySchema23,
|
|
6449
|
+
zodSchema as zodSchema23
|
|
6415
6450
|
} from "@ai-sdk/provider-utils";
|
|
6416
6451
|
import { z as z23 } from "zod/v4";
|
|
6417
|
-
var textEditor_20250429InputSchema =
|
|
6418
|
-
() =>
|
|
6452
|
+
var textEditor_20250429InputSchema = lazySchema23(
|
|
6453
|
+
() => zodSchema23(
|
|
6419
6454
|
z23.object({
|
|
6420
6455
|
command: z23.enum(["view", "create", "str_replace", "insert"]),
|
|
6421
6456
|
path: z23.string(),
|
|
@@ -6436,12 +6471,12 @@ var textEditor_20250429 = createProviderToolFactory11({
|
|
|
6436
6471
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6437
6472
|
import {
|
|
6438
6473
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
6439
|
-
lazySchema as
|
|
6440
|
-
zodSchema as
|
|
6474
|
+
lazySchema as lazySchema24,
|
|
6475
|
+
zodSchema as zodSchema24
|
|
6441
6476
|
} from "@ai-sdk/provider-utils";
|
|
6442
6477
|
import { z as z24 } from "zod/v4";
|
|
6443
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
6444
|
-
() =>
|
|
6478
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema24(
|
|
6479
|
+
() => zodSchema24(
|
|
6445
6480
|
z24.array(
|
|
6446
6481
|
z24.object({
|
|
6447
6482
|
type: z24.literal("tool_reference"),
|
|
@@ -6450,8 +6485,8 @@ var toolSearchBm25_20251119OutputSchema = lazySchema23(
|
|
|
6450
6485
|
)
|
|
6451
6486
|
)
|
|
6452
6487
|
);
|
|
6453
|
-
var toolSearchBm25_20251119InputSchema =
|
|
6454
|
-
() =>
|
|
6488
|
+
var toolSearchBm25_20251119InputSchema = lazySchema24(
|
|
6489
|
+
() => zodSchema24(
|
|
6455
6490
|
z24.object({
|
|
6456
6491
|
/**
|
|
6457
6492
|
* A natural language query to search for tools.
|