@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.js
CHANGED
|
@@ -29,14 +29,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
32
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.135" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
39
|
-
var
|
|
39
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/anthropic-error.ts
|
|
42
42
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -60,13 +60,13 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
60
60
|
// src/anthropic-messages-api.ts
|
|
61
61
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
62
62
|
var import_v42 = require("zod/v4");
|
|
63
|
-
var anthropicStopDetailsSchema = import_v42.z.object({
|
|
63
|
+
var anthropicStopDetailsSchema = () => import_v42.z.object({
|
|
64
64
|
type: import_v42.z.string(),
|
|
65
65
|
category: import_v42.z.string().nullish(),
|
|
66
66
|
explanation: import_v42.z.string().nullish(),
|
|
67
67
|
recommended_model: import_v42.z.string().nullish()
|
|
68
68
|
});
|
|
69
|
-
var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
69
|
+
var anthropicSafeguardResultSchema = () => import_v42.z.object({
|
|
70
70
|
type: import_v42.z.string(),
|
|
71
71
|
status: import_v42.z.object({
|
|
72
72
|
type: import_v42.z.string(),
|
|
@@ -80,7 +80,7 @@ var anthropicSafeguardResultSchema = import_v42.z.object({
|
|
|
80
80
|
).nullish()
|
|
81
81
|
})
|
|
82
82
|
});
|
|
83
|
-
var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
83
|
+
var anthropicToolCallCallerSchema = () => import_v42.z.union([
|
|
84
84
|
import_v42.z.object({
|
|
85
85
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
86
86
|
tool_id: import_v42.z.string()
|
|
@@ -93,7 +93,7 @@ var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
|
93
93
|
type: import_v42.z.literal("direct")
|
|
94
94
|
})
|
|
95
95
|
]);
|
|
96
|
-
var anthropicInputTransformationSchema = import_v42.z.object({
|
|
96
|
+
var anthropicInputTransformationSchema = () => import_v42.z.object({
|
|
97
97
|
type: import_v42.z.string(),
|
|
98
98
|
path: import_v42.z.string(),
|
|
99
99
|
reason: import_v42.z.string()
|
|
@@ -156,7 +156,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
156
156
|
name: import_v42.z.string(),
|
|
157
157
|
input: import_v42.z.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: import_v42.z.string().nullish()
|
|
162
162
|
}),
|
|
@@ -165,7 +165,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
165
165
|
id: import_v42.z.string(),
|
|
166
166
|
name: import_v42.z.string(),
|
|
167
167
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
168
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
168
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
169
169
|
}),
|
|
170
170
|
import_v42.z.object({
|
|
171
171
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -188,7 +188,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
188
188
|
import_v42.z.object({
|
|
189
189
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
190
190
|
tool_use_id: import_v42.z.string(),
|
|
191
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
191
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
192
192
|
content: import_v42.z.union([
|
|
193
193
|
import_v42.z.object({
|
|
194
194
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -221,7 +221,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
221
221
|
import_v42.z.object({
|
|
222
222
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
223
223
|
tool_use_id: import_v42.z.string(),
|
|
224
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
224
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
225
225
|
content: import_v42.z.union([
|
|
226
226
|
import_v42.z.array(
|
|
227
227
|
import_v42.z.object({
|
|
@@ -378,9 +378,9 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
378
378
|
),
|
|
379
379
|
stop_reason: import_v42.z.string().nullish(),
|
|
380
380
|
stop_sequence: import_v42.z.string().nullish(),
|
|
381
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
382
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
383
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
381
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
382
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
383
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
384
384
|
usage: import_v42.z.looseObject({
|
|
385
385
|
input_tokens: import_v42.z.number(),
|
|
386
386
|
output_tokens: import_v42.z.number(),
|
|
@@ -460,13 +460,13 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
460
460
|
id: import_v42.z.string(),
|
|
461
461
|
name: import_v42.z.string(),
|
|
462
462
|
input: import_v42.z.unknown(),
|
|
463
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
463
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
464
464
|
toolset_name: import_v42.z.string().nullish()
|
|
465
465
|
})
|
|
466
466
|
])
|
|
467
467
|
).nullish(),
|
|
468
468
|
stop_reason: import_v42.z.string().nullish(),
|
|
469
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
469
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
470
470
|
container: import_v42.z.object({
|
|
471
471
|
expires_at: import_v42.z.string(),
|
|
472
472
|
id: import_v42.z.string()
|
|
@@ -492,7 +492,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
492
492
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
493
493
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.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: import_v42.z.string().nullish()
|
|
498
498
|
}),
|
|
@@ -509,7 +509,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
509
509
|
id: import_v42.z.string(),
|
|
510
510
|
name: import_v42.z.string(),
|
|
511
511
|
input: import_v42.z.record(import_v42.z.string(), import_v42.z.unknown()).nullish(),
|
|
512
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
512
|
+
caller: anthropicToolCallCallerSchema().optional()
|
|
513
513
|
}),
|
|
514
514
|
import_v42.z.object({
|
|
515
515
|
type: import_v42.z.literal("mcp_tool_use"),
|
|
@@ -532,7 +532,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
532
532
|
import_v42.z.object({
|
|
533
533
|
type: import_v42.z.literal("web_fetch_tool_result"),
|
|
534
534
|
tool_use_id: import_v42.z.string(),
|
|
535
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
535
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
536
536
|
content: import_v42.z.union([
|
|
537
537
|
import_v42.z.object({
|
|
538
538
|
type: import_v42.z.literal("web_fetch_result"),
|
|
@@ -565,7 +565,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
565
565
|
import_v42.z.object({
|
|
566
566
|
type: import_v42.z.literal("web_search_tool_result"),
|
|
567
567
|
tool_use_id: import_v42.z.string(),
|
|
568
|
-
caller: anthropicToolCallCallerSchema.optional(),
|
|
568
|
+
caller: anthropicToolCallCallerSchema().optional(),
|
|
569
569
|
content: import_v42.z.union([
|
|
570
570
|
import_v42.z.array(
|
|
571
571
|
import_v42.z.object({
|
|
@@ -789,8 +789,8 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
789
789
|
delta: import_v42.z.object({
|
|
790
790
|
stop_reason: import_v42.z.string().nullish(),
|
|
791
791
|
stop_sequence: import_v42.z.string().nullish(),
|
|
792
|
-
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
793
|
-
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
792
|
+
stop_details: anthropicStopDetailsSchema().nullish(),
|
|
793
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema()).nullish(),
|
|
794
794
|
container: import_v42.z.object({
|
|
795
795
|
expires_at: import_v42.z.string(),
|
|
796
796
|
id: import_v42.z.string(),
|
|
@@ -830,7 +830,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
830
830
|
})
|
|
831
831
|
).nullish()
|
|
832
832
|
}),
|
|
833
|
-
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
833
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema()).nullish(),
|
|
834
834
|
context_management: import_v42.z.object({
|
|
835
835
|
applied_edits: import_v42.z.array(
|
|
836
836
|
import_v42.z.union([
|
|
@@ -870,349 +870,362 @@ var anthropicReasoningMetadataSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
870
870
|
);
|
|
871
871
|
|
|
872
872
|
// src/anthropic-messages-options.ts
|
|
873
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
873
874
|
var import_v43 = require("zod/v4");
|
|
874
|
-
var anthropicFilePartProviderOptions =
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
*/
|
|
883
|
-
enabled: import_v43.z.boolean()
|
|
884
|
-
}).optional(),
|
|
885
|
-
/**
|
|
886
|
-
* Custom title for the document.
|
|
887
|
-
* If not provided, the filename will be used.
|
|
888
|
-
*/
|
|
889
|
-
title: import_v43.z.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: import_v43.z.string().optional()
|
|
896
|
-
});
|
|
897
|
-
var anthropicSystemMessageProviderOptions = import_v43.z.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: import_v43.z.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: import_v43.z.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: import_v43.z.array(
|
|
927
|
-
import_v43.z.discriminatedUnion("type", [
|
|
928
|
-
import_v43.z.object({
|
|
929
|
-
type: import_v43.z.literal("tool_addition"),
|
|
930
|
-
toolName: import_v43.z.string()
|
|
931
|
-
}),
|
|
932
|
-
import_v43.z.object({
|
|
933
|
-
type: import_v43.z.literal("tool_removal"),
|
|
934
|
-
toolName: import_v43.z.string()
|
|
935
|
-
})
|
|
936
|
-
])
|
|
937
|
-
).optional()
|
|
938
|
-
});
|
|
939
|
-
var anthropicThinkingBlockBinding = import_v43.z.object({
|
|
940
|
-
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
941
|
-
});
|
|
942
|
-
var anthropicLanguageModelOptions = import_v43.z.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: import_v43.z.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: import_v43.z.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: import_v43.z.union([
|
|
972
|
-
import_v43.z.discriminatedUnion("type", [
|
|
973
|
-
import_v43.z.object({
|
|
974
|
-
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
975
|
-
type: import_v43.z.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: import_v43.z.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
|
-
import_v43.z.object({
|
|
992
|
-
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
993
|
-
type: import_v43.z.literal("enabled"),
|
|
994
|
-
budgetTokens: import_v43.z.number().optional()
|
|
995
|
-
}),
|
|
996
|
-
import_v43.z.object({
|
|
997
|
-
type: import_v43.z.literal("disabled")
|
|
998
|
-
}),
|
|
999
|
-
import_v43.z.object({
|
|
875
|
+
var anthropicFilePartProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
876
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
877
|
+
import_v43.z.object({
|
|
878
|
+
/**
|
|
879
|
+
* Citation configuration for this document.
|
|
880
|
+
* When enabled, this document will generate citations in the response.
|
|
881
|
+
*/
|
|
882
|
+
citations: import_v43.z.object({
|
|
1000
883
|
/**
|
|
1001
|
-
*
|
|
1002
|
-
* between tool calls are returned as summarized thinking blocks.
|
|
1003
|
-
* Only supported at `low`, `medium`, and `high` effort.
|
|
884
|
+
* Enable citations for this document
|
|
1004
885
|
*/
|
|
1005
|
-
|
|
1006
|
-
})
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
886
|
+
enabled: import_v43.z.boolean()
|
|
887
|
+
}).optional(),
|
|
888
|
+
/**
|
|
889
|
+
* Custom title for the document.
|
|
890
|
+
* If not provided, the filename will be used.
|
|
891
|
+
*/
|
|
892
|
+
title: import_v43.z.string().optional(),
|
|
893
|
+
/**
|
|
894
|
+
* Context about the document that will be passed to the model
|
|
895
|
+
* but not used towards cited content.
|
|
896
|
+
* Useful for storing document metadata as text or stringified JSON.
|
|
897
|
+
*/
|
|
898
|
+
context: import_v43.z.string().optional()
|
|
1014
899
|
})
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
*/
|
|
1020
|
-
disableParallelToolUse: import_v43.z.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: import_v43.z.object({
|
|
1026
|
-
type: import_v43.z.literal("ephemeral"),
|
|
1027
|
-
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.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: import_v43.z.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: import_v43.z.string().optional()
|
|
1042
|
-
}).optional(),
|
|
1043
|
-
/**
|
|
1044
|
-
* MCP servers to be utilized in this request.
|
|
1045
|
-
*/
|
|
1046
|
-
mcpServers: import_v43.z.array(
|
|
900
|
+
)
|
|
901
|
+
);
|
|
902
|
+
var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchema)(
|
|
903
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
1047
904
|
import_v43.z.object({
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
905
|
+
/**
|
|
906
|
+
* Clears this mid-conversation system message after the current turn.
|
|
907
|
+
*
|
|
908
|
+
* Requires the `mid-conversation-system-clear-at-2026-08-21` beta,
|
|
909
|
+
* which is added automatically.
|
|
910
|
+
*/
|
|
911
|
+
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
912
|
+
/**
|
|
913
|
+
* Sets the model effort from the next user turn until a later message
|
|
914
|
+
* changes it. An effort-only system message with empty content can appear
|
|
915
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
916
|
+
* added automatically.
|
|
917
|
+
*/
|
|
918
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
919
|
+
/**
|
|
920
|
+
* Mid-conversation tool changes. Adds or removes tools from the
|
|
921
|
+
* conversation's tool set between turns without invalidating the prompt
|
|
922
|
+
* cache.
|
|
923
|
+
*
|
|
924
|
+
* Only supported on system messages that appear mid-conversation (not the
|
|
925
|
+
* initial system prompt). A system message carrying tool changes must come
|
|
926
|
+
* right before an assistant message or at the end of the messages.
|
|
927
|
+
*
|
|
928
|
+
* Tools referenced by a `tool_addition` must be declared in the `tools`
|
|
929
|
+
* option (typically with `deferLoading: true` so they are not loaded until
|
|
930
|
+
* the addition surfaces them). The required
|
|
931
|
+
* `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
|
|
932
|
+
*/
|
|
933
|
+
toolChanges: import_v43.z.array(
|
|
934
|
+
import_v43.z.discriminatedUnion("type", [
|
|
935
|
+
import_v43.z.object({
|
|
936
|
+
type: import_v43.z.literal("tool_addition"),
|
|
937
|
+
toolName: import_v43.z.string()
|
|
938
|
+
}),
|
|
939
|
+
import_v43.z.object({
|
|
940
|
+
type: import_v43.z.literal("tool_removal"),
|
|
941
|
+
toolName: import_v43.z.string()
|
|
942
|
+
})
|
|
943
|
+
])
|
|
944
|
+
).optional()
|
|
1056
945
|
})
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
id: import_v43.z.string().optional(),
|
|
1065
|
-
skills: import_v43.z.array(
|
|
1066
|
-
import_v43.z.object({
|
|
1067
|
-
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1068
|
-
skillId: import_v43.z.string(),
|
|
1069
|
-
version: import_v43.z.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: import_v43.z.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: import_v43.z.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: import_v43.z.object({
|
|
1099
|
-
type: import_v43.z.literal("tokens"),
|
|
1100
|
-
total: import_v43.z.number().int().min(2e4),
|
|
1101
|
-
remaining: import_v43.z.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: import_v43.z.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: import_v43.z.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: import_v43.z.union([
|
|
1136
|
-
import_v43.z.literal("default"),
|
|
1137
|
-
import_v43.z.array(
|
|
1138
|
-
import_v43.z.object({
|
|
1139
|
-
model: import_v43.z.string(),
|
|
1140
|
-
max_tokens: import_v43.z.number().int().optional(),
|
|
1141
|
-
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1142
|
-
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1143
|
-
speed: import_v43.z.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: import_v43.z.array(import_v43.z.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: import_v43.z.array(
|
|
946
|
+
)
|
|
947
|
+
);
|
|
948
|
+
var anthropicLanguageModelOptions = (0, import_provider_utils3.lazySchema)(() => {
|
|
949
|
+
const anthropicThinkingBlockBinding = import_v43.z.object({
|
|
950
|
+
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
951
|
+
});
|
|
952
|
+
return (0, import_provider_utils3.zodSchema)(
|
|
1163
953
|
import_v43.z.object({
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
954
|
+
/**
|
|
955
|
+
* Whether to send reasoning to the model.
|
|
956
|
+
*
|
|
957
|
+
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
958
|
+
*/
|
|
959
|
+
sendReasoning: import_v43.z.boolean().optional(),
|
|
960
|
+
/**
|
|
961
|
+
* Determines how structured outputs are generated.
|
|
962
|
+
*
|
|
963
|
+
* - `outputFormat`: Use the `output_config.format` parameter to specify the structured output format.
|
|
964
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
965
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
966
|
+
*/
|
|
967
|
+
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
968
|
+
/**
|
|
969
|
+
* Configuration for enabling Claude's extended thinking.
|
|
970
|
+
*
|
|
971
|
+
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
972
|
+
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
973
|
+
*
|
|
974
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
975
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
976
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
977
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
978
|
+
*
|
|
979
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
980
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
981
|
+
*/
|
|
982
|
+
thinking: import_v43.z.union([
|
|
983
|
+
import_v43.z.discriminatedUnion("type", [
|
|
984
|
+
import_v43.z.object({
|
|
985
|
+
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
986
|
+
type: import_v43.z.literal("adaptive"),
|
|
987
|
+
/**
|
|
988
|
+
* Controls whether thinking content is included in the response.
|
|
989
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
990
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
991
|
+
* - `"updates"`: Thinking updates are returned between tool calls.
|
|
992
|
+
*/
|
|
993
|
+
display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
|
|
994
|
+
/**
|
|
995
|
+
* Controls how thinking blocks are bound to an assistant prefix.
|
|
996
|
+
*
|
|
997
|
+
* Requires the `thinking-binding-controls-2026-08-01` beta,
|
|
998
|
+
* which is added automatically.
|
|
999
|
+
*/
|
|
1000
|
+
blockBinding: anthropicThinkingBlockBinding.optional()
|
|
1001
|
+
}),
|
|
1002
|
+
import_v43.z.object({
|
|
1003
|
+
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
1004
|
+
type: import_v43.z.literal("enabled"),
|
|
1005
|
+
budgetTokens: import_v43.z.number().optional()
|
|
1006
|
+
}),
|
|
1007
|
+
import_v43.z.object({
|
|
1008
|
+
type: import_v43.z.literal("disabled")
|
|
1009
|
+
}),
|
|
1010
|
+
import_v43.z.object({
|
|
1011
|
+
/**
|
|
1012
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1013
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1014
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1015
|
+
*/
|
|
1016
|
+
type: import_v43.z.literal("between_tools")
|
|
1017
|
+
})
|
|
1018
|
+
]),
|
|
1019
|
+
/**
|
|
1020
|
+
* Configures prefix mismatch recovery without changing the model's
|
|
1021
|
+
* default thinking mode.
|
|
1022
|
+
*/
|
|
1023
|
+
import_v43.z.object({
|
|
1024
|
+
blockBinding: anthropicThinkingBlockBinding
|
|
1025
|
+
})
|
|
1026
|
+
]).optional(),
|
|
1027
|
+
/**
|
|
1028
|
+
* Whether to disable parallel function calling during tool use. Default is false.
|
|
1029
|
+
* When set to true, Claude will use at most one tool per response.
|
|
1030
|
+
*/
|
|
1031
|
+
disableParallelToolUse: import_v43.z.boolean().optional(),
|
|
1032
|
+
/**
|
|
1033
|
+
* Cache control settings for this message.
|
|
1034
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
1035
|
+
*/
|
|
1036
|
+
cacheControl: import_v43.z.object({
|
|
1037
|
+
type: import_v43.z.literal("ephemeral"),
|
|
1038
|
+
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
1039
|
+
}).optional(),
|
|
1040
|
+
/**
|
|
1041
|
+
* Metadata to include with the request.
|
|
1042
|
+
*
|
|
1043
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
1044
|
+
*/
|
|
1045
|
+
metadata: import_v43.z.object({
|
|
1046
|
+
/**
|
|
1047
|
+
* An external identifier for the user associated with the request.
|
|
1048
|
+
*
|
|
1049
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
1050
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
1051
|
+
*/
|
|
1052
|
+
userId: import_v43.z.string().optional()
|
|
1053
|
+
}).optional(),
|
|
1054
|
+
/**
|
|
1055
|
+
* MCP servers to be utilized in this request.
|
|
1056
|
+
*/
|
|
1057
|
+
mcpServers: import_v43.z.array(
|
|
1058
|
+
import_v43.z.object({
|
|
1059
|
+
type: import_v43.z.literal("url"),
|
|
1060
|
+
name: import_v43.z.string(),
|
|
1061
|
+
url: import_v43.z.string(),
|
|
1062
|
+
authorizationToken: import_v43.z.string().nullish(),
|
|
1063
|
+
toolConfiguration: import_v43.z.object({
|
|
1064
|
+
enabled: import_v43.z.boolean().nullish(),
|
|
1065
|
+
allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
|
|
1066
|
+
}).nullish()
|
|
1067
|
+
})
|
|
1068
|
+
).optional(),
|
|
1069
|
+
/**
|
|
1070
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
1071
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
1072
|
+
* Requires code execution tool to be enabled.
|
|
1073
|
+
*/
|
|
1074
|
+
container: import_v43.z.object({
|
|
1075
|
+
id: import_v43.z.string().optional(),
|
|
1076
|
+
skills: import_v43.z.array(
|
|
1077
|
+
import_v43.z.object({
|
|
1078
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
1079
|
+
skillId: import_v43.z.string(),
|
|
1080
|
+
version: import_v43.z.string().optional()
|
|
1081
|
+
})
|
|
1082
|
+
).optional()
|
|
1083
|
+
}).optional(),
|
|
1084
|
+
/**
|
|
1085
|
+
* Whether to enable fine-grained (eager) streaming of tool call inputs
|
|
1086
|
+
* and structured outputs for every function tool in the request. When
|
|
1087
|
+
* true (the default), each function tool receives a default of
|
|
1088
|
+
* `eager_input_streaming: true` unless it explicitly sets
|
|
1089
|
+
* `providerOptions.anthropic.eagerInputStreaming`.
|
|
1090
|
+
*
|
|
1091
|
+
* @default true
|
|
1092
|
+
*/
|
|
1093
|
+
toolStreaming: import_v43.z.boolean().optional(),
|
|
1094
|
+
/**
|
|
1095
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1096
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1097
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1098
|
+
*
|
|
1099
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1100
|
+
*/
|
|
1101
|
+
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1102
|
+
/**
|
|
1103
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
1104
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
1105
|
+
* gracefully as the budget is consumed.
|
|
1106
|
+
*
|
|
1107
|
+
* Advisory only — does not enforce a hard token limit.
|
|
1108
|
+
*/
|
|
1109
|
+
taskBudget: import_v43.z.object({
|
|
1110
|
+
type: import_v43.z.literal("tokens"),
|
|
1111
|
+
total: import_v43.z.number().int().min(2e4),
|
|
1112
|
+
remaining: import_v43.z.number().int().min(0).optional()
|
|
1113
|
+
}).optional(),
|
|
1114
|
+
/**
|
|
1115
|
+
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1116
|
+
* Only supported with claude-opus-4-6.
|
|
1117
|
+
*/
|
|
1118
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
1119
|
+
/**
|
|
1120
|
+
* Controls where model inference runs for this request.
|
|
1121
|
+
*
|
|
1122
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
1123
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
1124
|
+
*
|
|
1125
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1126
|
+
*/
|
|
1127
|
+
inferenceGeo: import_v43.z.enum(["us", "global"]).optional(),
|
|
1128
|
+
/**
|
|
1129
|
+
* Server-side fallback configuration.
|
|
1130
|
+
*
|
|
1131
|
+
* When the primary model's safety classifiers block a turn, the API
|
|
1132
|
+
* automatically retries it server-side on a fallback model. A
|
|
1133
|
+
* `content-filter` finish reason means the fallback(s) refused as well.
|
|
1134
|
+
*
|
|
1135
|
+
* - `'default'` (recommended): the API routes the retry to Anthropic's
|
|
1136
|
+
* recommended fallback model based on the refusal category. Requires the
|
|
1137
|
+
* `server-side-fallback-2026-07-01` beta, which is added automatically.
|
|
1138
|
+
* - Array form: an explicit fallback chain. Each entry is merged into the
|
|
1139
|
+
* request as a direct request to that entry's model, so it must be
|
|
1140
|
+
* formatted accordingly: `model` is required, and an entry may
|
|
1141
|
+
* additionally override `max_tokens`, `thinking`, `output_config`, and
|
|
1142
|
+
* `speed` for that attempt only (`speed` additionally requires the speed
|
|
1143
|
+
* beta). The value is passed through to the API as-is, and the
|
|
1144
|
+
* `server-side-fallback-2026-06-01` beta is added automatically.
|
|
1145
|
+
*/
|
|
1146
|
+
fallbacks: import_v43.z.union([
|
|
1147
|
+
import_v43.z.literal("default"),
|
|
1148
|
+
import_v43.z.array(
|
|
1149
|
+
import_v43.z.object({
|
|
1150
|
+
model: import_v43.z.string(),
|
|
1151
|
+
max_tokens: import_v43.z.number().int().optional(),
|
|
1152
|
+
thinking: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1153
|
+
output_config: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
1154
|
+
speed: import_v43.z.enum(["fast", "standard"]).optional()
|
|
1155
|
+
})
|
|
1156
|
+
)
|
|
1157
|
+
]).optional(),
|
|
1158
|
+
/**
|
|
1159
|
+
* A set of beta features to enable.
|
|
1160
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1161
|
+
*/
|
|
1162
|
+
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
1163
|
+
/**
|
|
1164
|
+
* Server-side safeguards to run as part of the request.
|
|
1165
|
+
*
|
|
1166
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1167
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1168
|
+
* relies on). The per-call verdicts are returned in
|
|
1169
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1170
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1171
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1172
|
+
*/
|
|
1173
|
+
safeguards: import_v43.z.array(
|
|
1171
1174
|
import_v43.z.object({
|
|
1172
|
-
type: import_v43.z.literal("
|
|
1173
|
-
|
|
1175
|
+
type: import_v43.z.literal("dangerous_tool_use"),
|
|
1176
|
+
classifierContext: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional()
|
|
1177
|
+
})
|
|
1178
|
+
).optional(),
|
|
1179
|
+
contextManagement: import_v43.z.object({
|
|
1180
|
+
edits: import_v43.z.array(
|
|
1181
|
+
import_v43.z.discriminatedUnion("type", [
|
|
1174
1182
|
import_v43.z.object({
|
|
1175
|
-
type: import_v43.z.literal("
|
|
1176
|
-
|
|
1183
|
+
type: import_v43.z.literal("clear_tool_uses_20250919"),
|
|
1184
|
+
trigger: import_v43.z.discriminatedUnion("type", [
|
|
1185
|
+
import_v43.z.object({
|
|
1186
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1187
|
+
value: import_v43.z.number()
|
|
1188
|
+
}),
|
|
1189
|
+
import_v43.z.object({
|
|
1190
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1191
|
+
value: import_v43.z.number()
|
|
1192
|
+
})
|
|
1193
|
+
]).optional(),
|
|
1194
|
+
keep: import_v43.z.object({
|
|
1195
|
+
type: import_v43.z.literal("tool_uses"),
|
|
1196
|
+
value: import_v43.z.number()
|
|
1197
|
+
}).optional(),
|
|
1198
|
+
clearAtLeast: import_v43.z.object({
|
|
1199
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1200
|
+
value: import_v43.z.number()
|
|
1201
|
+
}).optional(),
|
|
1202
|
+
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1203
|
+
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1177
1204
|
}),
|
|
1178
1205
|
import_v43.z.object({
|
|
1179
|
-
type: import_v43.z.literal("
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1189
|
-
value: import_v43.z.number()
|
|
1190
|
-
}).optional(),
|
|
1191
|
-
clearToolInputs: import_v43.z.boolean().optional(),
|
|
1192
|
-
excludeTools: import_v43.z.array(import_v43.z.string()).optional()
|
|
1193
|
-
}),
|
|
1194
|
-
import_v43.z.object({
|
|
1195
|
-
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1196
|
-
keep: import_v43.z.union([
|
|
1197
|
-
import_v43.z.literal("all"),
|
|
1206
|
+
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
1207
|
+
keep: import_v43.z.union([
|
|
1208
|
+
import_v43.z.literal("all"),
|
|
1209
|
+
import_v43.z.object({
|
|
1210
|
+
type: import_v43.z.literal("thinking_turns"),
|
|
1211
|
+
value: import_v43.z.number()
|
|
1212
|
+
})
|
|
1213
|
+
]).optional()
|
|
1214
|
+
}),
|
|
1198
1215
|
import_v43.z.object({
|
|
1199
|
-
type: import_v43.z.literal("
|
|
1200
|
-
|
|
1216
|
+
type: import_v43.z.literal("compact_20260112"),
|
|
1217
|
+
trigger: import_v43.z.object({
|
|
1218
|
+
type: import_v43.z.literal("input_tokens"),
|
|
1219
|
+
value: import_v43.z.number()
|
|
1220
|
+
}).optional(),
|
|
1221
|
+
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1222
|
+
instructions: import_v43.z.string().optional()
|
|
1201
1223
|
})
|
|
1202
|
-
])
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
type: import_v43.z.literal("input_tokens"),
|
|
1208
|
-
value: import_v43.z.number()
|
|
1209
|
-
}).optional(),
|
|
1210
|
-
pauseAfterCompaction: import_v43.z.boolean().optional(),
|
|
1211
|
-
instructions: import_v43.z.string().optional()
|
|
1212
|
-
})
|
|
1213
|
-
])
|
|
1214
|
-
)
|
|
1215
|
-
}).optional()
|
|
1224
|
+
])
|
|
1225
|
+
)
|
|
1226
|
+
}).optional()
|
|
1227
|
+
})
|
|
1228
|
+
);
|
|
1216
1229
|
});
|
|
1217
1230
|
|
|
1218
1231
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1220,19 +1233,24 @@ var import_provider = require("@ai-sdk/provider");
|
|
|
1220
1233
|
|
|
1221
1234
|
// src/get-cache-control.ts
|
|
1222
1235
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
1223
|
-
function getCacheControl(providerMetadata) {
|
|
1224
|
-
var _a;
|
|
1236
|
+
function getCacheControl(providerMetadata, providerOptionsName) {
|
|
1237
|
+
var _a, _b, _c;
|
|
1238
|
+
const custom = providerMetadata == null ? void 0 : providerMetadata[providerOptionsName];
|
|
1225
1239
|
const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
1226
|
-
const cacheControlValue = (_a = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ?
|
|
1240
|
+
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;
|
|
1227
1241
|
return cacheControlValue;
|
|
1228
1242
|
}
|
|
1229
1243
|
var CacheControlValidator = class {
|
|
1230
|
-
constructor() {
|
|
1244
|
+
constructor(providerOptionsName = "anthropic") {
|
|
1245
|
+
this.providerOptionsName = providerOptionsName;
|
|
1231
1246
|
this.breakpointCount = 0;
|
|
1232
1247
|
this.warnings = [];
|
|
1233
1248
|
}
|
|
1234
1249
|
getCacheControl(providerMetadata, context) {
|
|
1235
|
-
const cacheControlValue = getCacheControl(
|
|
1250
|
+
const cacheControlValue = getCacheControl(
|
|
1251
|
+
providerMetadata,
|
|
1252
|
+
this.providerOptionsName
|
|
1253
|
+
);
|
|
1236
1254
|
if (!cacheControlValue) {
|
|
1237
1255
|
return void 0;
|
|
1238
1256
|
}
|
|
@@ -1261,10 +1279,10 @@ var CacheControlValidator = class {
|
|
|
1261
1279
|
};
|
|
1262
1280
|
|
|
1263
1281
|
// src/tool/advisor_20260301.ts
|
|
1264
|
-
var
|
|
1282
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1265
1283
|
var import_v44 = require("zod/v4");
|
|
1266
|
-
var advisor_20260301ArgsSchema = (0,
|
|
1267
|
-
() => (0,
|
|
1284
|
+
var advisor_20260301ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1285
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1268
1286
|
import_v44.z.object({
|
|
1269
1287
|
model: import_v44.z.string(),
|
|
1270
1288
|
maxUses: import_v44.z.number().optional(),
|
|
@@ -1275,8 +1293,8 @@ var advisor_20260301ArgsSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1275
1293
|
})
|
|
1276
1294
|
)
|
|
1277
1295
|
);
|
|
1278
|
-
var advisor_20260301OutputSchema = (0,
|
|
1279
|
-
() => (0,
|
|
1296
|
+
var advisor_20260301OutputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1297
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
1280
1298
|
import_v44.z.discriminatedUnion("type", [
|
|
1281
1299
|
import_v44.z.object({
|
|
1282
1300
|
type: import_v44.z.literal("advisor_result"),
|
|
@@ -1293,10 +1311,10 @@ var advisor_20260301OutputSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
1293
1311
|
])
|
|
1294
1312
|
)
|
|
1295
1313
|
);
|
|
1296
|
-
var advisor_20260301InputSchema = (0,
|
|
1297
|
-
() => (0,
|
|
1314
|
+
var advisor_20260301InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1315
|
+
() => (0, import_provider_utils4.zodSchema)(import_v44.z.object({}).strict())
|
|
1298
1316
|
);
|
|
1299
|
-
var factory = (0,
|
|
1317
|
+
var factory = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
|
|
1300
1318
|
id: "anthropic.advisor_20260301",
|
|
1301
1319
|
inputSchema: advisor_20260301InputSchema,
|
|
1302
1320
|
outputSchema: advisor_20260301OutputSchema,
|
|
@@ -1307,7 +1325,7 @@ var advisor_20260301 = (args) => {
|
|
|
1307
1325
|
};
|
|
1308
1326
|
|
|
1309
1327
|
// src/tool/computer-toolset_20260801.ts
|
|
1310
|
-
var
|
|
1328
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1311
1329
|
var import_v45 = require("zod/v4");
|
|
1312
1330
|
var computerToolset_20260801Members = [
|
|
1313
1331
|
"screenshot",
|
|
@@ -1328,8 +1346,8 @@ var computerToolset_20260801Members = [
|
|
|
1328
1346
|
"hold_key",
|
|
1329
1347
|
"wait"
|
|
1330
1348
|
];
|
|
1331
|
-
var computerToolset_20260801InputSchema = (0,
|
|
1332
|
-
() => (0,
|
|
1349
|
+
var computerToolset_20260801InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1350
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1333
1351
|
import_v45.z.object({
|
|
1334
1352
|
action: import_v45.z.enum(computerToolset_20260801Members),
|
|
1335
1353
|
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
@@ -1348,8 +1366,8 @@ var computerToolset_20260801InputSchema = (0, import_provider_utils4.lazySchema)
|
|
|
1348
1366
|
})
|
|
1349
1367
|
)
|
|
1350
1368
|
);
|
|
1351
|
-
var computerToolset_20260801ArgsSchema = (0,
|
|
1352
|
-
() => (0,
|
|
1369
|
+
var computerToolset_20260801ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1370
|
+
() => (0, import_provider_utils5.zodSchema)(
|
|
1353
1371
|
import_v45.z.object({
|
|
1354
1372
|
configs: import_v45.z.partialRecord(
|
|
1355
1373
|
import_v45.z.enum(computerToolset_20260801Members),
|
|
@@ -1361,23 +1379,23 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
1361
1379
|
})
|
|
1362
1380
|
)
|
|
1363
1381
|
);
|
|
1364
|
-
var computerToolset_20260801 = (0,
|
|
1382
|
+
var computerToolset_20260801 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1365
1383
|
id: "anthropic.computer_toolset_20260801",
|
|
1366
1384
|
inputSchema: computerToolset_20260801InputSchema
|
|
1367
1385
|
});
|
|
1368
1386
|
|
|
1369
1387
|
// src/tool/text-editor_20250728.ts
|
|
1370
|
-
var
|
|
1388
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1371
1389
|
var import_v46 = require("zod/v4");
|
|
1372
|
-
var textEditor_20250728ArgsSchema = (0,
|
|
1373
|
-
() => (0,
|
|
1390
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1391
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1374
1392
|
import_v46.z.object({
|
|
1375
1393
|
maxCharacters: import_v46.z.number().optional()
|
|
1376
1394
|
})
|
|
1377
1395
|
)
|
|
1378
1396
|
);
|
|
1379
|
-
var textEditor_20250728InputSchema = (0,
|
|
1380
|
-
() => (0,
|
|
1397
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1398
|
+
() => (0, import_provider_utils6.zodSchema)(
|
|
1381
1399
|
import_v46.z.object({
|
|
1382
1400
|
command: import_v46.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1383
1401
|
path: import_v46.z.string(),
|
|
@@ -1390,7 +1408,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1390
1408
|
})
|
|
1391
1409
|
)
|
|
1392
1410
|
);
|
|
1393
|
-
var factory2 = (0,
|
|
1411
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactory)({
|
|
1394
1412
|
id: "anthropic.text_editor_20250728",
|
|
1395
1413
|
inputSchema: textEditor_20250728InputSchema
|
|
1396
1414
|
});
|
|
@@ -1399,10 +1417,10 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1399
1417
|
};
|
|
1400
1418
|
|
|
1401
1419
|
// src/tool/web-search_20260209.ts
|
|
1402
|
-
var
|
|
1420
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1403
1421
|
var import_v47 = require("zod/v4");
|
|
1404
|
-
var webSearch_20260209ArgsSchema = (0,
|
|
1405
|
-
() => (0,
|
|
1422
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1423
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1406
1424
|
import_v47.z.object({
|
|
1407
1425
|
maxUses: import_v47.z.number().optional(),
|
|
1408
1426
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
@@ -1417,8 +1435,8 @@ var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1417
1435
|
})
|
|
1418
1436
|
)
|
|
1419
1437
|
);
|
|
1420
|
-
var webSearch_20260209OutputSchema = (0,
|
|
1421
|
-
() => (0,
|
|
1438
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1439
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1422
1440
|
import_v47.z.array(
|
|
1423
1441
|
import_v47.z.object({
|
|
1424
1442
|
url: import_v47.z.string(),
|
|
@@ -1430,14 +1448,14 @@ var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1430
1448
|
)
|
|
1431
1449
|
)
|
|
1432
1450
|
);
|
|
1433
|
-
var webSearch_20260209InputSchema = (0,
|
|
1434
|
-
() => (0,
|
|
1451
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1452
|
+
() => (0, import_provider_utils7.zodSchema)(
|
|
1435
1453
|
import_v47.z.object({
|
|
1436
1454
|
query: import_v47.z.string()
|
|
1437
1455
|
})
|
|
1438
1456
|
)
|
|
1439
1457
|
);
|
|
1440
|
-
var factory3 = (0,
|
|
1458
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1441
1459
|
id: "anthropic.web_search_20260209",
|
|
1442
1460
|
inputSchema: webSearch_20260209InputSchema,
|
|
1443
1461
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1448,10 +1466,10 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1448
1466
|
};
|
|
1449
1467
|
|
|
1450
1468
|
// src/tool/web-search_20250305.ts
|
|
1451
|
-
var
|
|
1469
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1452
1470
|
var import_v48 = require("zod/v4");
|
|
1453
|
-
var webSearch_20250305ArgsSchema = (0,
|
|
1454
|
-
() => (0,
|
|
1471
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1472
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1455
1473
|
import_v48.z.object({
|
|
1456
1474
|
maxUses: import_v48.z.number().optional(),
|
|
1457
1475
|
allowedDomains: import_v48.z.array(import_v48.z.string()).optional(),
|
|
@@ -1466,8 +1484,8 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1466
1484
|
})
|
|
1467
1485
|
)
|
|
1468
1486
|
);
|
|
1469
|
-
var webSearch_20250305OutputSchema = (0,
|
|
1470
|
-
() => (0,
|
|
1487
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1488
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1471
1489
|
import_v48.z.array(
|
|
1472
1490
|
import_v48.z.object({
|
|
1473
1491
|
url: import_v48.z.string(),
|
|
@@ -1479,14 +1497,14 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1479
1497
|
)
|
|
1480
1498
|
)
|
|
1481
1499
|
);
|
|
1482
|
-
var webSearch_20250305InputSchema = (0,
|
|
1483
|
-
() => (0,
|
|
1500
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1501
|
+
() => (0, import_provider_utils8.zodSchema)(
|
|
1484
1502
|
import_v48.z.object({
|
|
1485
1503
|
query: import_v48.z.string()
|
|
1486
1504
|
})
|
|
1487
1505
|
)
|
|
1488
1506
|
);
|
|
1489
|
-
var factory4 = (0,
|
|
1507
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1490
1508
|
id: "anthropic.web_search_20250305",
|
|
1491
1509
|
inputSchema: webSearch_20250305InputSchema,
|
|
1492
1510
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1497,10 +1515,10 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1497
1515
|
};
|
|
1498
1516
|
|
|
1499
1517
|
// src/tool/web-fetch-20260209.ts
|
|
1500
|
-
var
|
|
1518
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1501
1519
|
var import_v49 = require("zod/v4");
|
|
1502
|
-
var webFetch_20260209ArgsSchema = (0,
|
|
1503
|
-
() => (0,
|
|
1520
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1521
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1504
1522
|
import_v49.z.object({
|
|
1505
1523
|
maxUses: import_v49.z.number().optional(),
|
|
1506
1524
|
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
@@ -1510,8 +1528,8 @@ var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1510
1528
|
})
|
|
1511
1529
|
)
|
|
1512
1530
|
);
|
|
1513
|
-
var webFetch_20260209OutputSchema = (0,
|
|
1514
|
-
() => (0,
|
|
1531
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1532
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1515
1533
|
import_v49.z.object({
|
|
1516
1534
|
type: import_v49.z.literal("web_fetch_result"),
|
|
1517
1535
|
url: import_v49.z.string(),
|
|
@@ -1536,14 +1554,14 @@ var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1536
1554
|
})
|
|
1537
1555
|
)
|
|
1538
1556
|
);
|
|
1539
|
-
var webFetch_20260209InputSchema = (0,
|
|
1540
|
-
() => (0,
|
|
1557
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1558
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1541
1559
|
import_v49.z.object({
|
|
1542
1560
|
url: import_v49.z.string()
|
|
1543
1561
|
})
|
|
1544
1562
|
)
|
|
1545
1563
|
);
|
|
1546
|
-
var factory5 = (0,
|
|
1564
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1547
1565
|
id: "anthropic.web_fetch_20260209",
|
|
1548
1566
|
inputSchema: webFetch_20260209InputSchema,
|
|
1549
1567
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1554,10 +1572,10 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1554
1572
|
};
|
|
1555
1573
|
|
|
1556
1574
|
// src/tool/web-fetch-20250910.ts
|
|
1557
|
-
var
|
|
1575
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1558
1576
|
var import_v410 = require("zod/v4");
|
|
1559
|
-
var webFetch_20250910ArgsSchema = (0,
|
|
1560
|
-
() => (0,
|
|
1577
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils10.lazySchema)(
|
|
1578
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1561
1579
|
import_v410.z.object({
|
|
1562
1580
|
maxUses: import_v410.z.number().optional(),
|
|
1563
1581
|
allowedDomains: import_v410.z.array(import_v410.z.string()).optional(),
|
|
@@ -1567,8 +1585,8 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1567
1585
|
})
|
|
1568
1586
|
)
|
|
1569
1587
|
);
|
|
1570
|
-
var webFetch_20250910OutputSchema = (0,
|
|
1571
|
-
() => (0,
|
|
1588
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1589
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1572
1590
|
import_v410.z.object({
|
|
1573
1591
|
type: import_v410.z.literal("web_fetch_result"),
|
|
1574
1592
|
url: import_v410.z.string(),
|
|
@@ -1593,14 +1611,14 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1593
1611
|
})
|
|
1594
1612
|
)
|
|
1595
1613
|
);
|
|
1596
|
-
var webFetch_20250910InputSchema = (0,
|
|
1597
|
-
() => (0,
|
|
1614
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1615
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1598
1616
|
import_v410.z.object({
|
|
1599
1617
|
url: import_v410.z.string()
|
|
1600
1618
|
})
|
|
1601
1619
|
)
|
|
1602
1620
|
);
|
|
1603
|
-
var factory6 = (0,
|
|
1621
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1604
1622
|
id: "anthropic.web_fetch_20250910",
|
|
1605
1623
|
inputSchema: webFetch_20250910InputSchema,
|
|
1606
1624
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1611,7 +1629,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1611
1629
|
};
|
|
1612
1630
|
|
|
1613
1631
|
// src/anthropic-prepare-tools.ts
|
|
1614
|
-
var
|
|
1632
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1615
1633
|
async function prepareTools({
|
|
1616
1634
|
tools,
|
|
1617
1635
|
toolChoice,
|
|
@@ -1724,7 +1742,7 @@ async function prepareTools({
|
|
|
1724
1742
|
break;
|
|
1725
1743
|
}
|
|
1726
1744
|
case "anthropic.computer_toolset_20260801": {
|
|
1727
|
-
const args = await (0,
|
|
1745
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1728
1746
|
value: tool.args,
|
|
1729
1747
|
schema: computerToolset_20260801ArgsSchema
|
|
1730
1748
|
});
|
|
@@ -1788,7 +1806,7 @@ async function prepareTools({
|
|
|
1788
1806
|
break;
|
|
1789
1807
|
}
|
|
1790
1808
|
case "anthropic.text_editor_20250728": {
|
|
1791
|
-
const args = await (0,
|
|
1809
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1792
1810
|
value: tool.args,
|
|
1793
1811
|
schema: textEditor_20250728ArgsSchema
|
|
1794
1812
|
});
|
|
@@ -1828,7 +1846,7 @@ async function prepareTools({
|
|
|
1828
1846
|
}
|
|
1829
1847
|
case "anthropic.web_fetch_20250910": {
|
|
1830
1848
|
betas.add("web-fetch-2025-09-10");
|
|
1831
|
-
const args = await (0,
|
|
1849
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1832
1850
|
value: tool.args,
|
|
1833
1851
|
schema: webFetch_20250910ArgsSchema
|
|
1834
1852
|
});
|
|
@@ -1846,7 +1864,7 @@ async function prepareTools({
|
|
|
1846
1864
|
}
|
|
1847
1865
|
case "anthropic.web_fetch_20260209": {
|
|
1848
1866
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1849
|
-
const args = await (0,
|
|
1867
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1850
1868
|
value: tool.args,
|
|
1851
1869
|
schema: webFetch_20260209ArgsSchema
|
|
1852
1870
|
});
|
|
@@ -1863,7 +1881,7 @@ async function prepareTools({
|
|
|
1863
1881
|
break;
|
|
1864
1882
|
}
|
|
1865
1883
|
case "anthropic.web_search_20250305": {
|
|
1866
|
-
const args = await (0,
|
|
1884
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1867
1885
|
value: tool.args,
|
|
1868
1886
|
schema: webSearch_20250305ArgsSchema
|
|
1869
1887
|
});
|
|
@@ -1880,7 +1898,7 @@ async function prepareTools({
|
|
|
1880
1898
|
}
|
|
1881
1899
|
case "anthropic.web_search_20260209": {
|
|
1882
1900
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1883
|
-
const args = await (0,
|
|
1901
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1884
1902
|
value: tool.args,
|
|
1885
1903
|
schema: webSearch_20260209ArgsSchema
|
|
1886
1904
|
});
|
|
@@ -1911,7 +1929,7 @@ async function prepareTools({
|
|
|
1911
1929
|
}
|
|
1912
1930
|
case "anthropic.advisor_20260301": {
|
|
1913
1931
|
betas.add("advisor-tool-2026-03-01");
|
|
1914
|
-
const args = await (0,
|
|
1932
|
+
const args = await (0, import_provider_utils11.validateTypes)({
|
|
1915
1933
|
value: tool.args,
|
|
1916
1934
|
schema: advisor_20260301ArgsSchema
|
|
1917
1935
|
});
|
|
@@ -2088,13 +2106,13 @@ function convertAnthropicMessagesUsage({
|
|
|
2088
2106
|
|
|
2089
2107
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2090
2108
|
var import_provider2 = require("@ai-sdk/provider");
|
|
2091
|
-
var
|
|
2109
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
2092
2110
|
|
|
2093
2111
|
// src/tool/code-execution_20250522.ts
|
|
2094
|
-
var
|
|
2112
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2095
2113
|
var import_v411 = require("zod/v4");
|
|
2096
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
2097
|
-
() => (0,
|
|
2114
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2115
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2098
2116
|
import_v411.z.object({
|
|
2099
2117
|
type: import_v411.z.literal("code_execution_result"),
|
|
2100
2118
|
stdout: import_v411.z.string(),
|
|
@@ -2109,14 +2127,14 @@ var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)
|
|
|
2109
2127
|
})
|
|
2110
2128
|
)
|
|
2111
2129
|
);
|
|
2112
|
-
var codeExecution_20250522InputSchema = (0,
|
|
2113
|
-
() => (0,
|
|
2130
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
2131
|
+
() => (0, import_provider_utils12.zodSchema)(
|
|
2114
2132
|
import_v411.z.object({
|
|
2115
2133
|
code: import_v411.z.string()
|
|
2116
2134
|
})
|
|
2117
2135
|
)
|
|
2118
2136
|
);
|
|
2119
|
-
var factory7 = (0,
|
|
2137
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2120
2138
|
id: "anthropic.code_execution_20250522",
|
|
2121
2139
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2122
2140
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -2126,10 +2144,10 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2126
2144
|
};
|
|
2127
2145
|
|
|
2128
2146
|
// src/tool/code-execution_20250825.ts
|
|
2129
|
-
var
|
|
2147
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2130
2148
|
var import_v412 = require("zod/v4");
|
|
2131
|
-
var codeExecution_20250825OutputSchema = (0,
|
|
2132
|
-
() => (0,
|
|
2149
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2150
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2133
2151
|
import_v412.z.discriminatedUnion("type", [
|
|
2134
2152
|
import_v412.z.object({
|
|
2135
2153
|
type: import_v412.z.literal("code_execution_result"),
|
|
@@ -2186,8 +2204,8 @@ var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
2186
2204
|
])
|
|
2187
2205
|
)
|
|
2188
2206
|
);
|
|
2189
|
-
var codeExecution_20250825InputSchema = (0,
|
|
2190
|
-
() => (0,
|
|
2207
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
2208
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
2191
2209
|
import_v412.z.discriminatedUnion("type", [
|
|
2192
2210
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2193
2211
|
import_v412.z.object({
|
|
@@ -2221,7 +2239,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2221
2239
|
])
|
|
2222
2240
|
)
|
|
2223
2241
|
);
|
|
2224
|
-
var factory8 = (0,
|
|
2242
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2225
2243
|
id: "anthropic.code_execution_20250825",
|
|
2226
2244
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2227
2245
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2235,10 +2253,10 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2235
2253
|
};
|
|
2236
2254
|
|
|
2237
2255
|
// src/tool/code-execution_20260120.ts
|
|
2238
|
-
var
|
|
2256
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2239
2257
|
var import_v413 = require("zod/v4");
|
|
2240
|
-
var codeExecution_20260120OutputSchema = (0,
|
|
2241
|
-
() => (0,
|
|
2258
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2259
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2242
2260
|
import_v413.z.discriminatedUnion("type", [
|
|
2243
2261
|
import_v413.z.object({
|
|
2244
2262
|
type: import_v413.z.literal("code_execution_result"),
|
|
@@ -2307,8 +2325,8 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)
|
|
|
2307
2325
|
])
|
|
2308
2326
|
)
|
|
2309
2327
|
);
|
|
2310
|
-
var codeExecution_20260120InputSchema = (0,
|
|
2311
|
-
() => (0,
|
|
2328
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2329
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2312
2330
|
import_v413.z.discriminatedUnion("type", [
|
|
2313
2331
|
import_v413.z.object({
|
|
2314
2332
|
type: import_v413.z.literal("programmatic-tool-call"),
|
|
@@ -2341,7 +2359,7 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2341
2359
|
])
|
|
2342
2360
|
)
|
|
2343
2361
|
);
|
|
2344
|
-
var factory9 = (0,
|
|
2362
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2345
2363
|
id: "anthropic.code_execution_20260120",
|
|
2346
2364
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2347
2365
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2352,10 +2370,10 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2352
2370
|
};
|
|
2353
2371
|
|
|
2354
2372
|
// src/tool/tool-search-regex_20251119.ts
|
|
2355
|
-
var
|
|
2373
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
2356
2374
|
var import_v414 = require("zod/v4");
|
|
2357
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
2358
|
-
() => (0,
|
|
2375
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2376
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2359
2377
|
import_v414.z.array(
|
|
2360
2378
|
import_v414.z.object({
|
|
2361
2379
|
type: import_v414.z.literal("tool_reference"),
|
|
@@ -2364,8 +2382,8 @@ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchem
|
|
|
2364
2382
|
)
|
|
2365
2383
|
)
|
|
2366
2384
|
);
|
|
2367
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
2368
|
-
() => (0,
|
|
2385
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
2386
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
2369
2387
|
import_v414.z.object({
|
|
2370
2388
|
/**
|
|
2371
2389
|
* A regex pattern to search for tools.
|
|
@@ -2385,7 +2403,7 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
|
|
|
2385
2403
|
})
|
|
2386
2404
|
)
|
|
2387
2405
|
);
|
|
2388
|
-
var factory10 = (0,
|
|
2406
|
+
var factory10 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
2389
2407
|
id: "anthropic.tool_search_regex_20251119",
|
|
2390
2408
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2391
2409
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2398,7 +2416,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2398
2416
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2399
2417
|
function convertToString(data) {
|
|
2400
2418
|
if (typeof data === "string") {
|
|
2401
|
-
return new TextDecoder().decode((0,
|
|
2419
|
+
return new TextDecoder().decode((0, import_provider_utils16.convertBase64ToUint8Array)(data));
|
|
2402
2420
|
}
|
|
2403
2421
|
if (data instanceof Uint8Array) {
|
|
2404
2422
|
return new TextDecoder().decode(data);
|
|
@@ -2423,7 +2441,7 @@ function getUrlString(data) {
|
|
|
2423
2441
|
}
|
|
2424
2442
|
async function extractErrorValue(value) {
|
|
2425
2443
|
if (typeof value === "string") {
|
|
2426
|
-
const result = await (0,
|
|
2444
|
+
const result = await (0, import_provider_utils16.safeParseJSON)({ text: value });
|
|
2427
2445
|
if (result.success && typeof result.value === "object" && result.value !== null) {
|
|
2428
2446
|
return result.value;
|
|
2429
2447
|
}
|
|
@@ -2442,7 +2460,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2442
2460
|
warnings,
|
|
2443
2461
|
cacheControlValidator,
|
|
2444
2462
|
toolNameMapping,
|
|
2445
|
-
toolsetNames = {}
|
|
2463
|
+
toolsetNames = {},
|
|
2464
|
+
convertMediaPart
|
|
2446
2465
|
}) {
|
|
2447
2466
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2448
2467
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -2453,7 +2472,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2453
2472
|
let lastUserMessageIndex = -1;
|
|
2454
2473
|
async function shouldEnableCitations(providerMetadata) {
|
|
2455
2474
|
var _a2, _b2;
|
|
2456
|
-
const anthropicOptions = await (0,
|
|
2475
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2457
2476
|
provider: "anthropic",
|
|
2458
2477
|
providerOptions: providerMetadata,
|
|
2459
2478
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2461,7 +2480,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2461
2480
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2462
2481
|
}
|
|
2463
2482
|
async function getDocumentMetadata(providerMetadata) {
|
|
2464
|
-
const anthropicOptions = await (0,
|
|
2483
|
+
const anthropicOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2465
2484
|
provider: "anthropic",
|
|
2466
2485
|
providerOptions: providerMetadata,
|
|
2467
2486
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2481,7 +2500,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2481
2500
|
let toolChangeCount = 0;
|
|
2482
2501
|
let hasMidConversationOptions = false;
|
|
2483
2502
|
for (const { content: text, providerOptions } of block.messages) {
|
|
2484
|
-
const systemMessageOptions = await (0,
|
|
2503
|
+
const systemMessageOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2485
2504
|
provider: "anthropic",
|
|
2486
2505
|
providerOptions,
|
|
2487
2506
|
schema: anthropicSystemMessageProviderOptions
|
|
@@ -2585,6 +2604,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2585
2604
|
break;
|
|
2586
2605
|
}
|
|
2587
2606
|
case "file": {
|
|
2607
|
+
const customContent = await (convertMediaPart == null ? void 0 : convertMediaPart(part));
|
|
2608
|
+
if (customContent != null) {
|
|
2609
|
+
anthropicContent.push({
|
|
2610
|
+
...customContent,
|
|
2611
|
+
cache_control: cacheControl
|
|
2612
|
+
});
|
|
2613
|
+
break;
|
|
2614
|
+
}
|
|
2588
2615
|
if (part.mediaType.startsWith("image/")) {
|
|
2589
2616
|
anthropicContent.push({
|
|
2590
2617
|
type: "image",
|
|
@@ -2594,7 +2621,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2594
2621
|
} : {
|
|
2595
2622
|
type: "base64",
|
|
2596
2623
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2597
|
-
data: (0,
|
|
2624
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2598
2625
|
},
|
|
2599
2626
|
cache_control: cacheControl
|
|
2600
2627
|
});
|
|
@@ -2614,7 +2641,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2614
2641
|
} : {
|
|
2615
2642
|
type: "base64",
|
|
2616
2643
|
media_type: "application/pdf",
|
|
2617
|
-
data: (0,
|
|
2644
|
+
data: (0, import_provider_utils16.convertToBase64)(part.data)
|
|
2618
2645
|
},
|
|
2619
2646
|
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
2620
2647
|
...metadata.context && { context: metadata.context },
|
|
@@ -2758,7 +2785,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2758
2785
|
return void 0;
|
|
2759
2786
|
}
|
|
2760
2787
|
}
|
|
2761
|
-
}).filter(
|
|
2788
|
+
}).filter(import_provider_utils16.isNonNullable);
|
|
2762
2789
|
break;
|
|
2763
2790
|
case "text":
|
|
2764
2791
|
case "error-text":
|
|
@@ -2843,7 +2870,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2843
2870
|
}
|
|
2844
2871
|
case "reasoning": {
|
|
2845
2872
|
if (sendReasoning) {
|
|
2846
|
-
const reasoningMetadata = await (0,
|
|
2873
|
+
const reasoningMetadata = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2847
2874
|
provider: "anthropic",
|
|
2848
2875
|
providerOptions: part.providerOptions,
|
|
2849
2876
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -3041,7 +3068,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3041
3068
|
let errorInfo = {};
|
|
3042
3069
|
try {
|
|
3043
3070
|
if (typeof output.value === "string") {
|
|
3044
|
-
errorInfo = (0,
|
|
3071
|
+
errorInfo = (0, import_provider_utils16.secureJsonParse)(output.value);
|
|
3045
3072
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
3046
3073
|
errorInfo = output.value;
|
|
3047
3074
|
}
|
|
@@ -3085,7 +3112,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3085
3112
|
break;
|
|
3086
3113
|
}
|
|
3087
3114
|
if (output.value.type === "code_execution_result") {
|
|
3088
|
-
const codeExecutionOutput = await (0,
|
|
3115
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3089
3116
|
value: output.value,
|
|
3090
3117
|
schema: codeExecution_20250522OutputSchema
|
|
3091
3118
|
});
|
|
@@ -3102,7 +3129,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3102
3129
|
cache_control: cacheControl
|
|
3103
3130
|
});
|
|
3104
3131
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
3105
|
-
const codeExecutionOutput = await (0,
|
|
3132
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3106
3133
|
value: output.value,
|
|
3107
3134
|
schema: codeExecution_20260120OutputSchema
|
|
3108
3135
|
});
|
|
@@ -3121,7 +3148,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3121
3148
|
});
|
|
3122
3149
|
}
|
|
3123
3150
|
} else {
|
|
3124
|
-
const codeExecutionOutput = await (0,
|
|
3151
|
+
const codeExecutionOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3125
3152
|
value: output.value,
|
|
3126
3153
|
schema: codeExecution_20250825OutputSchema
|
|
3127
3154
|
});
|
|
@@ -3186,7 +3213,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3186
3213
|
});
|
|
3187
3214
|
break;
|
|
3188
3215
|
}
|
|
3189
|
-
const webFetchOutput = await (0,
|
|
3216
|
+
const webFetchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3190
3217
|
value: output.value,
|
|
3191
3218
|
schema: webFetch_20250910OutputSchema
|
|
3192
3219
|
});
|
|
@@ -3235,7 +3262,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3235
3262
|
});
|
|
3236
3263
|
break;
|
|
3237
3264
|
}
|
|
3238
|
-
const webSearchOutput = await (0,
|
|
3265
|
+
const webSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3239
3266
|
value: output.value,
|
|
3240
3267
|
schema: webSearch_20250305OutputSchema
|
|
3241
3268
|
});
|
|
@@ -3275,7 +3302,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3275
3302
|
});
|
|
3276
3303
|
break;
|
|
3277
3304
|
}
|
|
3278
|
-
const toolSearchOutput = await (0,
|
|
3305
|
+
const toolSearchOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3279
3306
|
value: output.value,
|
|
3280
3307
|
schema: toolSearchRegex_20251119OutputSchema
|
|
3281
3308
|
});
|
|
@@ -3303,7 +3330,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3303
3330
|
});
|
|
3304
3331
|
break;
|
|
3305
3332
|
}
|
|
3306
|
-
const advisorOutput = await (0,
|
|
3333
|
+
const advisorOutput = await (0, import_provider_utils16.validateTypes)({
|
|
3307
3334
|
value: output.value,
|
|
3308
3335
|
schema: advisor_20260301OutputSchema
|
|
3309
3336
|
});
|
|
@@ -3743,7 +3770,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3743
3770
|
var _a;
|
|
3744
3771
|
this.modelId = modelId;
|
|
3745
3772
|
this.config = config;
|
|
3746
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3773
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils17.generateId;
|
|
3747
3774
|
}
|
|
3748
3775
|
supportsUrl(url) {
|
|
3749
3776
|
return url.protocol === "https:";
|
|
@@ -3781,7 +3808,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3781
3808
|
providerOptions,
|
|
3782
3809
|
stream
|
|
3783
3810
|
}) {
|
|
3784
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3811
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3785
3812
|
const warnings = [];
|
|
3786
3813
|
if (frequencyPenalty != null) {
|
|
3787
3814
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3792,18 +3819,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3792
3819
|
if (seed != null) {
|
|
3793
3820
|
warnings.push({ type: "unsupported", feature: "seed" });
|
|
3794
3821
|
}
|
|
3795
|
-
|
|
3822
|
+
const maxTemperature = (_a = this.config.maxTemperature) != null ? _a : 1;
|
|
3823
|
+
const temperatureProvider = this.config.maxTemperature == null ? "anthropic" : this.providerOptionsName;
|
|
3824
|
+
if (temperature != null && temperature > maxTemperature) {
|
|
3796
3825
|
warnings.push({
|
|
3797
3826
|
type: "unsupported",
|
|
3798
3827
|
feature: "temperature",
|
|
3799
|
-
details: `${temperature} exceeds
|
|
3828
|
+
details: `${temperature} exceeds ${temperatureProvider} maximum of ${maxTemperature.toFixed(1)}. clamped to ${maxTemperature.toFixed(1)}`
|
|
3800
3829
|
});
|
|
3801
|
-
temperature =
|
|
3830
|
+
temperature = maxTemperature;
|
|
3802
3831
|
} else if (temperature != null && temperature < 0) {
|
|
3803
3832
|
warnings.push({
|
|
3804
3833
|
type: "unsupported",
|
|
3805
3834
|
feature: "temperature",
|
|
3806
|
-
details: `${temperature} is below
|
|
3835
|
+
details: `${temperature} is below ${temperatureProvider} minimum of 0. clamped to 0`
|
|
3807
3836
|
});
|
|
3808
3837
|
temperature = 0;
|
|
3809
3838
|
}
|
|
@@ -3817,12 +3846,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3817
3846
|
}
|
|
3818
3847
|
}
|
|
3819
3848
|
const providerOptionsName = this.providerOptionsName;
|
|
3820
|
-
const canonicalOptions = await (0,
|
|
3849
|
+
const canonicalOptions = await (0, import_provider_utils17.parseProviderOptions)({
|
|
3821
3850
|
provider: "anthropic",
|
|
3822
3851
|
providerOptions,
|
|
3823
3852
|
schema: anthropicLanguageModelOptions
|
|
3824
3853
|
});
|
|
3825
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3854
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils17.parseProviderOptions)({
|
|
3826
3855
|
provider: providerOptionsName,
|
|
3827
3856
|
providerOptions,
|
|
3828
3857
|
schema: anthropicLanguageModelOptions
|
|
@@ -3878,9 +3907,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3878
3907
|
}
|
|
3879
3908
|
}
|
|
3880
3909
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3881
|
-
const supportsStructuredOutput = ((
|
|
3882
|
-
const supportsStrictTools = ((
|
|
3883
|
-
const structureOutputMode = (
|
|
3910
|
+
const supportsStructuredOutput = ((_b = this.config.supportsNativeStructuredOutput) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3911
|
+
const supportsStrictTools = ((_c = this.config.supportsStrictTools) != null ? _c : true) && modelSupportsStructuredOutput;
|
|
3912
|
+
const structureOutputMode = (_d = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _d : "auto";
|
|
3884
3913
|
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
3885
3914
|
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
3886
3915
|
warnings.push({
|
|
@@ -3904,8 +3933,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3904
3933
|
});
|
|
3905
3934
|
}
|
|
3906
3935
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3907
|
-
const cacheControlValidator = new CacheControlValidator(
|
|
3908
|
-
|
|
3936
|
+
const cacheControlValidator = new CacheControlValidator(
|
|
3937
|
+
this.config.cacheControlProviderOptionsName
|
|
3938
|
+
);
|
|
3939
|
+
const toolNameMapping = (0, import_provider_utils17.createToolNameMapping)({
|
|
3909
3940
|
tools,
|
|
3910
3941
|
providerToolNames: {
|
|
3911
3942
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -3934,11 +3965,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3934
3965
|
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3935
3966
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
3936
3967
|
prompt,
|
|
3937
|
-
sendReasoning: (
|
|
3968
|
+
sendReasoning: (_e = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _e : true,
|
|
3938
3969
|
warnings,
|
|
3939
3970
|
cacheControlValidator,
|
|
3940
3971
|
toolNameMapping,
|
|
3941
|
-
toolsetNames
|
|
3972
|
+
toolsetNames,
|
|
3973
|
+
convertMediaPart: this.config.convertMediaPart
|
|
3942
3974
|
});
|
|
3943
3975
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
3944
3976
|
const requestedThinking = anthropicOptions.thinking;
|
|
@@ -4048,7 +4080,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4048
4080
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
4049
4081
|
cache_control: anthropicOptions.cacheControl
|
|
4050
4082
|
},
|
|
4051
|
-
...((
|
|
4083
|
+
...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
|
|
4052
4084
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
4053
4085
|
},
|
|
4054
4086
|
// mcp servers:
|
|
@@ -4156,7 +4188,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4156
4188
|
};
|
|
4157
4189
|
thinkingBudget = 1024;
|
|
4158
4190
|
}
|
|
4159
|
-
if (baseArgs.temperature != null) {
|
|
4191
|
+
if (baseArgs.temperature != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4160
4192
|
baseArgs.temperature = void 0;
|
|
4161
4193
|
warnings.push({
|
|
4162
4194
|
type: "unsupported",
|
|
@@ -4172,7 +4204,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4172
4204
|
details: "topK is not supported when thinking is enabled"
|
|
4173
4205
|
});
|
|
4174
4206
|
}
|
|
4175
|
-
if (topP != null) {
|
|
4207
|
+
if (topP != null && !this.config.supportsTemperatureAndTopPWithThinking) {
|
|
4176
4208
|
baseArgs.top_p = void 0;
|
|
4177
4209
|
warnings.push({
|
|
4178
4210
|
type: "unsupported",
|
|
@@ -4243,7 +4275,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4243
4275
|
} else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
|
|
4244
4276
|
betas.add("server-side-fallback-2026-06-01");
|
|
4245
4277
|
}
|
|
4246
|
-
const defaultEagerInputStreaming = stream && ((
|
|
4278
|
+
const defaultEagerInputStreaming = stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true);
|
|
4247
4279
|
const {
|
|
4248
4280
|
tools: anthropicTools2,
|
|
4249
4281
|
toolChoice: anthropicToolChoice,
|
|
@@ -4284,7 +4316,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4284
4316
|
...betas,
|
|
4285
4317
|
...toolsBetas,
|
|
4286
4318
|
...userSuppliedBetas,
|
|
4287
|
-
...(
|
|
4319
|
+
...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
|
|
4288
4320
|
]),
|
|
4289
4321
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
4290
4322
|
toolNameMapping,
|
|
@@ -4296,15 +4328,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4296
4328
|
betas,
|
|
4297
4329
|
headers
|
|
4298
4330
|
}) {
|
|
4299
|
-
return (0,
|
|
4300
|
-
await (0,
|
|
4331
|
+
return (0, import_provider_utils17.combineHeaders)(
|
|
4332
|
+
await (0, import_provider_utils17.resolve)(this.config.headers),
|
|
4301
4333
|
headers,
|
|
4302
4334
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
4303
4335
|
);
|
|
4304
4336
|
}
|
|
4305
4337
|
async getBetasFromHeaders(requestHeaders) {
|
|
4306
4338
|
var _a, _b;
|
|
4307
|
-
const configHeaders = await (0,
|
|
4339
|
+
const configHeaders = await (0, import_provider_utils17.resolve)(this.config.headers);
|
|
4308
4340
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
4309
4341
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
4310
4342
|
return new Set(
|
|
@@ -4370,12 +4402,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4370
4402
|
responseHeaders,
|
|
4371
4403
|
value: response,
|
|
4372
4404
|
rawValue: rawResponse
|
|
4373
|
-
} = await (0,
|
|
4405
|
+
} = await (0, import_provider_utils17.postJsonToApi)({
|
|
4374
4406
|
url: this.buildRequestUrl(false),
|
|
4375
4407
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4376
4408
|
body: this.transformRequestBody(args, betas),
|
|
4377
4409
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4378
|
-
successfulResponseHandler: (0,
|
|
4410
|
+
successfulResponseHandler: (0, import_provider_utils17.createJsonResponseHandler)(
|
|
4379
4411
|
anthropicMessagesResponseSchema
|
|
4380
4412
|
),
|
|
4381
4413
|
abortSignal: options.abortSignal,
|
|
@@ -4890,12 +4922,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4890
4922
|
body.tools
|
|
4891
4923
|
);
|
|
4892
4924
|
const url = this.buildRequestUrl(true);
|
|
4893
|
-
const { responseHeaders, value: response } = await (0,
|
|
4925
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils17.postJsonToApi)({
|
|
4894
4926
|
url,
|
|
4895
4927
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
4896
4928
|
body: this.transformRequestBody(body, betas),
|
|
4897
4929
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
4898
|
-
successfulResponseHandler: (0,
|
|
4930
|
+
successfulResponseHandler: (0, import_provider_utils17.createEventSourceResponseHandler)(
|
|
4899
4931
|
anthropicMessagesChunkSchema
|
|
4900
4932
|
),
|
|
4901
4933
|
abortSignal: options.abortSignal,
|
|
@@ -5441,7 +5473,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5441
5473
|
if (contentBlock.toolset != null) {
|
|
5442
5474
|
let memberInput = {};
|
|
5443
5475
|
try {
|
|
5444
|
-
memberInput = contentBlock.input === "" ? {} : (0,
|
|
5476
|
+
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils17.secureJsonParse)(contentBlock.input);
|
|
5445
5477
|
} catch (e) {
|
|
5446
5478
|
memberInput = void 0;
|
|
5447
5479
|
}
|
|
@@ -5464,7 +5496,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5464
5496
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
5465
5497
|
if (contentBlock.providerToolName === "code_execution") {
|
|
5466
5498
|
try {
|
|
5467
|
-
const parsed = (0,
|
|
5499
|
+
const parsed = (0, import_provider_utils17.secureJsonParse)(finalInput);
|
|
5468
5500
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
5469
5501
|
finalInput = JSON.stringify({
|
|
5470
5502
|
type: "programmatic-tool-call",
|
|
@@ -6088,42 +6120,42 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
6088
6120
|
}
|
|
6089
6121
|
|
|
6090
6122
|
// src/tool/bash_20241022.ts
|
|
6091
|
-
var
|
|
6123
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
6092
6124
|
var import_v415 = require("zod/v4");
|
|
6093
|
-
var bash_20241022InputSchema = (0,
|
|
6094
|
-
() => (0,
|
|
6125
|
+
var bash_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
6126
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
6095
6127
|
import_v415.z.object({
|
|
6096
6128
|
command: import_v415.z.string(),
|
|
6097
6129
|
restart: import_v415.z.boolean().optional()
|
|
6098
6130
|
})
|
|
6099
6131
|
)
|
|
6100
6132
|
);
|
|
6101
|
-
var bash_20241022 = (0,
|
|
6133
|
+
var bash_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
6102
6134
|
id: "anthropic.bash_20241022",
|
|
6103
6135
|
inputSchema: bash_20241022InputSchema
|
|
6104
6136
|
});
|
|
6105
6137
|
|
|
6106
6138
|
// src/tool/bash_20250124.ts
|
|
6107
|
-
var
|
|
6139
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
6108
6140
|
var import_v416 = require("zod/v4");
|
|
6109
|
-
var bash_20250124InputSchema = (0,
|
|
6110
|
-
() => (0,
|
|
6141
|
+
var bash_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
6142
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
6111
6143
|
import_v416.z.object({
|
|
6112
6144
|
command: import_v416.z.string(),
|
|
6113
6145
|
restart: import_v416.z.boolean().optional()
|
|
6114
6146
|
})
|
|
6115
6147
|
)
|
|
6116
6148
|
);
|
|
6117
|
-
var bash_20250124 = (0,
|
|
6149
|
+
var bash_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
6118
6150
|
id: "anthropic.bash_20250124",
|
|
6119
6151
|
inputSchema: bash_20250124InputSchema
|
|
6120
6152
|
});
|
|
6121
6153
|
|
|
6122
6154
|
// src/tool/computer_20241022.ts
|
|
6123
|
-
var
|
|
6155
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
6124
6156
|
var import_v417 = require("zod/v4");
|
|
6125
|
-
var computer_20241022InputSchema = (0,
|
|
6126
|
-
() => (0,
|
|
6157
|
+
var computer_20241022InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
6158
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
6127
6159
|
import_v417.z.object({
|
|
6128
6160
|
action: import_v417.z.enum([
|
|
6129
6161
|
"key",
|
|
@@ -6142,16 +6174,16 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
6142
6174
|
})
|
|
6143
6175
|
)
|
|
6144
6176
|
);
|
|
6145
|
-
var computer_20241022 = (0,
|
|
6177
|
+
var computer_20241022 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
6146
6178
|
id: "anthropic.computer_20241022",
|
|
6147
6179
|
inputSchema: computer_20241022InputSchema
|
|
6148
6180
|
});
|
|
6149
6181
|
|
|
6150
6182
|
// src/tool/computer_20250124.ts
|
|
6151
|
-
var
|
|
6183
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
6152
6184
|
var import_v418 = require("zod/v4");
|
|
6153
|
-
var computer_20250124InputSchema = (0,
|
|
6154
|
-
() => (0,
|
|
6185
|
+
var computer_20250124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
6186
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
6155
6187
|
import_v418.z.object({
|
|
6156
6188
|
action: import_v418.z.enum([
|
|
6157
6189
|
"key",
|
|
@@ -6180,16 +6212,16 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
6180
6212
|
})
|
|
6181
6213
|
)
|
|
6182
6214
|
);
|
|
6183
|
-
var computer_20250124 = (0,
|
|
6215
|
+
var computer_20250124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
6184
6216
|
id: "anthropic.computer_20250124",
|
|
6185
6217
|
inputSchema: computer_20250124InputSchema
|
|
6186
6218
|
});
|
|
6187
6219
|
|
|
6188
6220
|
// src/tool/computer_20251124.ts
|
|
6189
|
-
var
|
|
6221
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
6190
6222
|
var import_v419 = require("zod/v4");
|
|
6191
|
-
var computer_20251124InputSchema = (0,
|
|
6192
|
-
() => (0,
|
|
6223
|
+
var computer_20251124InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
6224
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
6193
6225
|
import_v419.z.object({
|
|
6194
6226
|
action: import_v419.z.enum([
|
|
6195
6227
|
"key",
|
|
@@ -6225,16 +6257,16 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
6225
6257
|
})
|
|
6226
6258
|
)
|
|
6227
6259
|
);
|
|
6228
|
-
var computer_20251124 = (0,
|
|
6260
|
+
var computer_20251124 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
6229
6261
|
id: "anthropic.computer_20251124",
|
|
6230
6262
|
inputSchema: computer_20251124InputSchema
|
|
6231
6263
|
});
|
|
6232
6264
|
|
|
6233
6265
|
// src/tool/memory_20250818.ts
|
|
6234
|
-
var
|
|
6266
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
6235
6267
|
var import_v420 = require("zod/v4");
|
|
6236
|
-
var memory_20250818InputSchema = (0,
|
|
6237
|
-
() => (0,
|
|
6268
|
+
var memory_20250818InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
6269
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
6238
6270
|
import_v420.z.discriminatedUnion("command", [
|
|
6239
6271
|
import_v420.z.object({
|
|
6240
6272
|
command: import_v420.z.literal("view"),
|
|
@@ -6270,16 +6302,16 @@ var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
6270
6302
|
])
|
|
6271
6303
|
)
|
|
6272
6304
|
);
|
|
6273
|
-
var memory_20250818 = (0,
|
|
6305
|
+
var memory_20250818 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
6274
6306
|
id: "anthropic.memory_20250818",
|
|
6275
6307
|
inputSchema: memory_20250818InputSchema
|
|
6276
6308
|
});
|
|
6277
6309
|
|
|
6278
6310
|
// src/tool/text-editor_20241022.ts
|
|
6279
|
-
var
|
|
6311
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
6280
6312
|
var import_v421 = require("zod/v4");
|
|
6281
|
-
var textEditor_20241022InputSchema = (0,
|
|
6282
|
-
() => (0,
|
|
6313
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
6314
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
6283
6315
|
import_v421.z.object({
|
|
6284
6316
|
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6285
6317
|
path: import_v421.z.string(),
|
|
@@ -6292,16 +6324,16 @@ var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
6292
6324
|
})
|
|
6293
6325
|
)
|
|
6294
6326
|
);
|
|
6295
|
-
var textEditor_20241022 = (0,
|
|
6327
|
+
var textEditor_20241022 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
6296
6328
|
id: "anthropic.text_editor_20241022",
|
|
6297
6329
|
inputSchema: textEditor_20241022InputSchema
|
|
6298
6330
|
});
|
|
6299
6331
|
|
|
6300
6332
|
// src/tool/text-editor_20250124.ts
|
|
6301
|
-
var
|
|
6333
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
6302
6334
|
var import_v422 = require("zod/v4");
|
|
6303
|
-
var textEditor_20250124InputSchema = (0,
|
|
6304
|
-
() => (0,
|
|
6335
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
6336
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
6305
6337
|
import_v422.z.object({
|
|
6306
6338
|
command: import_v422.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
6307
6339
|
path: import_v422.z.string(),
|
|
@@ -6314,16 +6346,16 @@ var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
6314
6346
|
})
|
|
6315
6347
|
)
|
|
6316
6348
|
);
|
|
6317
|
-
var textEditor_20250124 = (0,
|
|
6349
|
+
var textEditor_20250124 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
6318
6350
|
id: "anthropic.text_editor_20250124",
|
|
6319
6351
|
inputSchema: textEditor_20250124InputSchema
|
|
6320
6352
|
});
|
|
6321
6353
|
|
|
6322
6354
|
// src/tool/text-editor_20250429.ts
|
|
6323
|
-
var
|
|
6355
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
6324
6356
|
var import_v423 = require("zod/v4");
|
|
6325
|
-
var textEditor_20250429InputSchema = (0,
|
|
6326
|
-
() => (0,
|
|
6357
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
6358
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
6327
6359
|
import_v423.z.object({
|
|
6328
6360
|
command: import_v423.z.enum(["view", "create", "str_replace", "insert"]),
|
|
6329
6361
|
path: import_v423.z.string(),
|
|
@@ -6336,16 +6368,16 @@ var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
6336
6368
|
})
|
|
6337
6369
|
)
|
|
6338
6370
|
);
|
|
6339
|
-
var textEditor_20250429 = (0,
|
|
6371
|
+
var textEditor_20250429 = (0, import_provider_utils26.createProviderToolFactory)({
|
|
6340
6372
|
id: "anthropic.text_editor_20250429",
|
|
6341
6373
|
inputSchema: textEditor_20250429InputSchema
|
|
6342
6374
|
});
|
|
6343
6375
|
|
|
6344
6376
|
// src/tool/tool-search-bm25_20251119.ts
|
|
6345
|
-
var
|
|
6377
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
6346
6378
|
var import_v424 = require("zod/v4");
|
|
6347
|
-
var toolSearchBm25_20251119OutputSchema = (0,
|
|
6348
|
-
() => (0,
|
|
6379
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6380
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6349
6381
|
import_v424.z.array(
|
|
6350
6382
|
import_v424.z.object({
|
|
6351
6383
|
type: import_v424.z.literal("tool_reference"),
|
|
@@ -6354,8 +6386,8 @@ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema
|
|
|
6354
6386
|
)
|
|
6355
6387
|
)
|
|
6356
6388
|
);
|
|
6357
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
6358
|
-
() => (0,
|
|
6389
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils27.lazySchema)(
|
|
6390
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
6359
6391
|
import_v424.z.object({
|
|
6360
6392
|
/**
|
|
6361
6393
|
* A natural language query to search for tools.
|
|
@@ -6369,7 +6401,7 @@ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)
|
|
|
6369
6401
|
})
|
|
6370
6402
|
)
|
|
6371
6403
|
);
|
|
6372
|
-
var factory11 = (0,
|
|
6404
|
+
var factory11 = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
6373
6405
|
id: "anthropic.tool_search_bm25_20251119",
|
|
6374
6406
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
6375
6407
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -6637,13 +6669,13 @@ var anthropicTools = {
|
|
|
6637
6669
|
var ANTHROPIC_API_URL = "https://api.anthropic.com";
|
|
6638
6670
|
var ANTHROPIC_API_VERSIONED_URL = `${ANTHROPIC_API_URL}/v1`;
|
|
6639
6671
|
function normalizeBaseURL(baseURL) {
|
|
6640
|
-
const baseURLWithoutTrailingSlash = (0,
|
|
6672
|
+
const baseURLWithoutTrailingSlash = (0, import_provider_utils28.withoutTrailingSlash)(baseURL);
|
|
6641
6673
|
return baseURLWithoutTrailingSlash === ANTHROPIC_API_URL ? ANTHROPIC_API_VERSIONED_URL : baseURLWithoutTrailingSlash;
|
|
6642
6674
|
}
|
|
6643
6675
|
function createAnthropic(options = {}) {
|
|
6644
6676
|
var _a, _b;
|
|
6645
6677
|
const baseURL = (_a = normalizeBaseURL(
|
|
6646
|
-
(0,
|
|
6678
|
+
(0, import_provider_utils28.loadOptionalSetting)({
|
|
6647
6679
|
settingValue: options.baseURL,
|
|
6648
6680
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
6649
6681
|
})
|
|
@@ -6657,13 +6689,13 @@ function createAnthropic(options = {}) {
|
|
|
6657
6689
|
}
|
|
6658
6690
|
const getHeaders = () => {
|
|
6659
6691
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
6660
|
-
"x-api-key": (0,
|
|
6692
|
+
"x-api-key": (0, import_provider_utils28.loadApiKey)({
|
|
6661
6693
|
apiKey: options.apiKey,
|
|
6662
6694
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
6663
6695
|
description: "Anthropic"
|
|
6664
6696
|
})
|
|
6665
6697
|
};
|
|
6666
|
-
return (0,
|
|
6698
|
+
return (0, import_provider_utils28.withUserAgentSuffix)(
|
|
6667
6699
|
{
|
|
6668
6700
|
"anthropic-version": "2023-06-01",
|
|
6669
6701
|
...authHeaders,
|
|
@@ -6679,7 +6711,7 @@ function createAnthropic(options = {}) {
|
|
|
6679
6711
|
baseURL,
|
|
6680
6712
|
headers: getHeaders,
|
|
6681
6713
|
fetch: options.fetch,
|
|
6682
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
6714
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils28.generateId,
|
|
6683
6715
|
supportedUrls: () => ({
|
|
6684
6716
|
"image/*": [/^https?:\/\/.*$/],
|
|
6685
6717
|
"application/pdf": [/^https?:\/\/.*$/]
|