@ai-sdk/anthropic 3.0.126 → 3.0.128
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 +17 -0
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +86 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +6 -1
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.js +85 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +85 -7
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +65 -2
- package/package.json +1 -1
- package/src/anthropic-message-metadata.ts +14 -0
- package/src/anthropic-messages-api.ts +23 -0
- package/src/anthropic-messages-language-model.ts +86 -12
- package/src/anthropic-messages-options.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.128
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bedd5bb: feat(anthropic): add Claude Haiku 5.5 support
|
|
8
|
+
|
|
9
|
+
- add the `claude-haiku-5-5` model ID to `@ai-sdk/anthropic` and `@ai-sdk/google-vertex`, `anthropic.claude-haiku-5-5` and `us.anthropic.claude-haiku-5-5` to `@ai-sdk/amazon-bedrock`, and `anthropic/claude-haiku-5.5` to `@ai-sdk/gateway`
|
|
10
|
+
- recognize `claude-haiku-5-5` as a known model with a 128k max output token limit and all five effort levels; thinking can be disabled up to `high` effort, and `xhigh` and `max` are lowered to `high` with a warning when thinking is disabled
|
|
11
|
+
- `claude-haiku-5-5` does not support thinking token budgets: `thinking: { type: 'enabled', budgetTokens }` is converted to adaptive thinking with a warning
|
|
12
|
+
- use the JSON tool fallback for structured output on Amazon Bedrock for `claude-haiku-5-5`
|
|
13
|
+
|
|
14
|
+
## 3.0.127
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- d5c12b2: feat(provider/anthropic): add `safeguards` provider option and `safeguardResults` provider metadata (dangerous tool use classifier)
|
|
19
|
+
|
|
3
20
|
## 3.0.126
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,19 @@ import { z } from 'zod/v4';
|
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
|
+
declare const anthropicSafeguardResultSchema: z.ZodObject<{
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
status: z.ZodObject<{
|
|
9
|
+
type: z.ZodString;
|
|
10
|
+
tool_uses: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
explanation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
}, z.core.$strip>>>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type AnthropicSafeguardResult = z.infer<typeof anthropicSafeguardResultSchema>;
|
|
18
|
+
|
|
6
19
|
/**
|
|
7
20
|
* Represents a single iteration in the usage breakdown.
|
|
8
21
|
*
|
|
@@ -58,6 +71,18 @@ interface AnthropicMessageMetadata {
|
|
|
58
71
|
path: string;
|
|
59
72
|
reason: string;
|
|
60
73
|
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Verdicts of the server-side safeguards requested with
|
|
76
|
+
* `providerOptions.anthropic.safeguards`, one entry per requested safeguard.
|
|
77
|
+
* For `dangerous_tool_use`, `status.type` is `'available'` when the
|
|
78
|
+
* classifier ran and `status.tool_uses` maps each tool call id to its
|
|
79
|
+
* verdict (`type: 'evaluated'` with an `outcome` of `'not_flagged'` or
|
|
80
|
+
* `'flagged'` plus an `explanation`, `'skipped'`, or `'unavailable'`).
|
|
81
|
+
*
|
|
82
|
+
* Kept in the API's wire shape (snake_case), since consumers such as Claude
|
|
83
|
+
* Code read the verdicts verbatim.
|
|
84
|
+
*/
|
|
85
|
+
safeguardResults?: AnthropicSafeguardResult[];
|
|
61
86
|
/**
|
|
62
87
|
* Details about why the request stopped. Present only when the API returns
|
|
63
88
|
* a `refusal` stop reason together with a `stop_details` object (a
|
|
@@ -195,7 +220,7 @@ interface AnthropicMessageMetadata {
|
|
|
195
220
|
} | null;
|
|
196
221
|
}
|
|
197
222
|
|
|
198
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
223
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
199
224
|
/**
|
|
200
225
|
* Anthropic provider options for system messages.
|
|
201
226
|
*/
|
|
@@ -220,9 +245,9 @@ type AnthropicSystemMessageProviderOptions = z.infer<typeof anthropicSystemMessa
|
|
|
220
245
|
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
221
246
|
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
222
247
|
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
248
|
+
auto: "auto";
|
|
223
249
|
outputFormat: "outputFormat";
|
|
224
250
|
jsonTool: "jsonTool";
|
|
225
|
-
auto: "auto";
|
|
226
251
|
}>>;
|
|
227
252
|
thinking: z.ZodOptional<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
228
253
|
type: z.ZodLiteral<"adaptive">;
|
|
@@ -310,6 +335,10 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
310
335
|
}>>;
|
|
311
336
|
}, z.core.$strip>>]>>;
|
|
312
337
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
338
|
+
safeguards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
339
|
+
type: z.ZodLiteral<"dangerous_tool_use">;
|
|
340
|
+
classifierContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
341
|
+
}, z.core.$strip>>>;
|
|
313
342
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
314
343
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
315
344
|
type: z.ZodLiteral<"clear_tool_uses_20250919">;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,19 @@ import { z } from 'zod/v4';
|
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
6
|
+
declare const anthropicSafeguardResultSchema: z.ZodObject<{
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
status: z.ZodObject<{
|
|
9
|
+
type: z.ZodString;
|
|
10
|
+
tool_uses: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
explanation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
}, z.core.$strip>>>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type AnthropicSafeguardResult = z.infer<typeof anthropicSafeguardResultSchema>;
|
|
18
|
+
|
|
6
19
|
/**
|
|
7
20
|
* Represents a single iteration in the usage breakdown.
|
|
8
21
|
*
|
|
@@ -58,6 +71,18 @@ interface AnthropicMessageMetadata {
|
|
|
58
71
|
path: string;
|
|
59
72
|
reason: string;
|
|
60
73
|
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Verdicts of the server-side safeguards requested with
|
|
76
|
+
* `providerOptions.anthropic.safeguards`, one entry per requested safeguard.
|
|
77
|
+
* For `dangerous_tool_use`, `status.type` is `'available'` when the
|
|
78
|
+
* classifier ran and `status.tool_uses` maps each tool call id to its
|
|
79
|
+
* verdict (`type: 'evaluated'` with an `outcome` of `'not_flagged'` or
|
|
80
|
+
* `'flagged'` plus an `explanation`, `'skipped'`, or `'unavailable'`).
|
|
81
|
+
*
|
|
82
|
+
* Kept in the API's wire shape (snake_case), since consumers such as Claude
|
|
83
|
+
* Code read the verdicts verbatim.
|
|
84
|
+
*/
|
|
85
|
+
safeguardResults?: AnthropicSafeguardResult[];
|
|
61
86
|
/**
|
|
62
87
|
* Details about why the request stopped. Present only when the API returns
|
|
63
88
|
* a `refusal` stop reason together with a `stop_details` object (a
|
|
@@ -195,7 +220,7 @@ interface AnthropicMessageMetadata {
|
|
|
195
220
|
} | null;
|
|
196
221
|
}
|
|
197
222
|
|
|
198
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
223
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
199
224
|
/**
|
|
200
225
|
* Anthropic provider options for system messages.
|
|
201
226
|
*/
|
|
@@ -220,9 +245,9 @@ type AnthropicSystemMessageProviderOptions = z.infer<typeof anthropicSystemMessa
|
|
|
220
245
|
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
221
246
|
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
222
247
|
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
248
|
+
auto: "auto";
|
|
223
249
|
outputFormat: "outputFormat";
|
|
224
250
|
jsonTool: "jsonTool";
|
|
225
|
-
auto: "auto";
|
|
226
251
|
}>>;
|
|
227
252
|
thinking: z.ZodOptional<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
228
253
|
type: z.ZodLiteral<"adaptive">;
|
|
@@ -310,6 +335,10 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
310
335
|
}>>;
|
|
311
336
|
}, z.core.$strip>>]>>;
|
|
312
337
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
338
|
+
safeguards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
339
|
+
type: z.ZodLiteral<"dangerous_tool_use">;
|
|
340
|
+
classifierContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
341
|
+
}, z.core.$strip>>>;
|
|
313
342
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
314
343
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
315
344
|
type: z.ZodLiteral<"clear_tool_uses_20250919">;
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.128" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -66,6 +66,20 @@ var anthropicStopDetailsSchema = import_v42.z.object({
|
|
|
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({
|
|
70
|
+
type: import_v42.z.string(),
|
|
71
|
+
status: import_v42.z.object({
|
|
72
|
+
type: import_v42.z.string(),
|
|
73
|
+
tool_uses: import_v42.z.record(
|
|
74
|
+
import_v42.z.string(),
|
|
75
|
+
import_v42.z.object({
|
|
76
|
+
type: import_v42.z.string(),
|
|
77
|
+
outcome: import_v42.z.string().nullish(),
|
|
78
|
+
explanation: import_v42.z.string().nullish()
|
|
79
|
+
})
|
|
80
|
+
).nullish()
|
|
81
|
+
})
|
|
82
|
+
});
|
|
69
83
|
var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
70
84
|
import_v42.z.object({
|
|
71
85
|
type: import_v42.z.literal("code_execution_20250825"),
|
|
@@ -366,6 +380,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
366
380
|
stop_sequence: import_v42.z.string().nullish(),
|
|
367
381
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
368
382
|
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
383
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
369
384
|
usage: import_v42.z.looseObject({
|
|
370
385
|
input_tokens: import_v42.z.number(),
|
|
371
386
|
output_tokens: import_v42.z.number(),
|
|
@@ -775,6 +790,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
775
790
|
stop_reason: import_v42.z.string().nullish(),
|
|
776
791
|
stop_sequence: import_v42.z.string().nullish(),
|
|
777
792
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
793
|
+
safeguard_results: import_v42.z.array(anthropicSafeguardResultSchema).nullish(),
|
|
778
794
|
container: import_v42.z.object({
|
|
779
795
|
expires_at: import_v42.z.string(),
|
|
780
796
|
id: import_v42.z.string(),
|
|
@@ -1133,6 +1149,22 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
1133
1149
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1134
1150
|
*/
|
|
1135
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(
|
|
1163
|
+
import_v43.z.object({
|
|
1164
|
+
type: import_v43.z.literal("dangerous_tool_use"),
|
|
1165
|
+
classifierContext: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional()
|
|
1166
|
+
})
|
|
1167
|
+
).optional(),
|
|
1136
1168
|
contextManagement: import_v43.z.object({
|
|
1137
1169
|
edits: import_v43.z.array(
|
|
1138
1170
|
import_v43.z.discriminatedUnion("type", [
|
|
@@ -3790,6 +3822,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3790
3822
|
rejectsSamplingParameters,
|
|
3791
3823
|
rejectsThinkingDisabledAboveHighEffort,
|
|
3792
3824
|
rejectsThinkingDisabled,
|
|
3825
|
+
rejectsBudgetThinking,
|
|
3793
3826
|
rejectsForcedToolUse,
|
|
3794
3827
|
supportsBetweenToolsThinking,
|
|
3795
3828
|
isKnownModel
|
|
@@ -3907,15 +3940,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3907
3940
|
details: `thinking cannot be disabled for ${this.modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
3908
3941
|
});
|
|
3909
3942
|
anthropicOptions.thinking = void 0;
|
|
3910
|
-
} else if (requestedType === "enabled") {
|
|
3911
|
-
warnings.push({
|
|
3912
|
-
type: "unsupported",
|
|
3913
|
-
feature: "providerOptions.anthropic.thinking",
|
|
3914
|
-
details: `budget-based thinking is not supported by ${this.modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
|
|
3915
|
-
});
|
|
3916
|
-
anthropicOptions.thinking = { type: "adaptive" };
|
|
3917
3943
|
}
|
|
3918
3944
|
}
|
|
3945
|
+
if (rejectsBudgetThinking && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null && "type" in anthropicOptions.thinking && anthropicOptions.thinking.type === "enabled") {
|
|
3946
|
+
warnings.push({
|
|
3947
|
+
type: "unsupported",
|
|
3948
|
+
feature: "providerOptions.anthropic.thinking",
|
|
3949
|
+
details: rejectsThinkingDisabled ? `budget-based thinking is not supported by ${this.modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.` : `budget-based thinking is not supported by ${this.modelId}. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
|
|
3950
|
+
});
|
|
3951
|
+
anthropicOptions.thinking = { type: "adaptive" };
|
|
3952
|
+
}
|
|
3919
3953
|
const thinking = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
|
|
3920
3954
|
const thinkingType = thinking != null && "type" in thinking ? thinking.type : void 0;
|
|
3921
3955
|
if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
@@ -4033,6 +4067,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4033
4067
|
// prompt:
|
|
4034
4068
|
system: messagesPrompt.system,
|
|
4035
4069
|
messages: messagesPrompt.messages,
|
|
4070
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.safeguards) && anthropicOptions.safeguards.length > 0 && {
|
|
4071
|
+
safeguards: anthropicOptions.safeguards.map((safeguard) => ({
|
|
4072
|
+
type: safeguard.type,
|
|
4073
|
+
...safeguard.classifierContext !== void 0 && {
|
|
4074
|
+
classifier_context: safeguard.classifierContext
|
|
4075
|
+
}
|
|
4076
|
+
}))
|
|
4077
|
+
},
|
|
4036
4078
|
...contextManagement && {
|
|
4037
4079
|
context_management: {
|
|
4038
4080
|
edits: contextManagement.edits.map((edit) => {
|
|
@@ -4145,6 +4187,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4145
4187
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0) {
|
|
4146
4188
|
betas.add("mcp-client-2025-04-04");
|
|
4147
4189
|
}
|
|
4190
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.safeguards) && anthropicOptions.safeguards.length > 0) {
|
|
4191
|
+
betas.add("dangerous-tool-use-2026-09-03");
|
|
4192
|
+
}
|
|
4148
4193
|
if (contextManagement) {
|
|
4149
4194
|
betas.add("context-management-2025-06-27");
|
|
4150
4195
|
if (contextManagement.edits.some((e) => e.type === "compact_20260112")) {
|
|
@@ -4768,6 +4813,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4768
4813
|
stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
|
|
4769
4814
|
...stopDetails != null ? { stopDetails } : {},
|
|
4770
4815
|
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
4816
|
+
...response.safeguard_results != null ? { safeguardResults: response.safeguard_results } : {},
|
|
4771
4817
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4772
4818
|
(iter) => ({
|
|
4773
4819
|
type: iter.type,
|
|
@@ -4858,6 +4904,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4858
4904
|
let stopSequence = null;
|
|
4859
4905
|
let stopDetails = void 0;
|
|
4860
4906
|
let inputTransformations;
|
|
4907
|
+
let safeguardResults;
|
|
4861
4908
|
let container = null;
|
|
4862
4909
|
let isJsonResponseFromTool = false;
|
|
4863
4910
|
let isMessageOpen = false;
|
|
@@ -5679,6 +5726,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5679
5726
|
if (value.input_transformations != null) {
|
|
5680
5727
|
inputTransformations = value.input_transformations;
|
|
5681
5728
|
}
|
|
5729
|
+
if (value.delta.safeguard_results != null) {
|
|
5730
|
+
safeguardResults = value.delta.safeguard_results;
|
|
5731
|
+
}
|
|
5682
5732
|
rawUsage = {
|
|
5683
5733
|
...rawUsage,
|
|
5684
5734
|
...value.usage
|
|
@@ -5694,6 +5744,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5694
5744
|
stopSequence,
|
|
5695
5745
|
...stopDetails != null ? { stopDetails } : {},
|
|
5696
5746
|
...inputTransformations != null ? { inputTransformations } : {},
|
|
5747
|
+
...safeguardResults != null ? { safeguardResults } : {},
|
|
5697
5748
|
iterations: usage.iterations ? usage.iterations.map(
|
|
5698
5749
|
(iter) => ({
|
|
5699
5750
|
type: iter.type,
|
|
@@ -5777,6 +5828,7 @@ function getModelCapabilities(modelId) {
|
|
|
5777
5828
|
rejectsSamplingParameters: true,
|
|
5778
5829
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5779
5830
|
rejectsThinkingDisabled: true,
|
|
5831
|
+
rejectsBudgetThinking: true,
|
|
5780
5832
|
rejectsForcedToolUse: true,
|
|
5781
5833
|
supportsBetweenToolsThinking: true,
|
|
5782
5834
|
isKnownModel: true
|
|
@@ -5788,10 +5840,23 @@ function getModelCapabilities(modelId) {
|
|
|
5788
5840
|
rejectsSamplingParameters: true,
|
|
5789
5841
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5790
5842
|
rejectsThinkingDisabled: true,
|
|
5843
|
+
rejectsBudgetThinking: true,
|
|
5791
5844
|
rejectsForcedToolUse: true,
|
|
5792
5845
|
supportsBetweenToolsThinking: false,
|
|
5793
5846
|
isKnownModel: true
|
|
5794
5847
|
};
|
|
5848
|
+
} else if (modelId.includes("claude-haiku-5-5")) {
|
|
5849
|
+
return {
|
|
5850
|
+
maxOutputTokens: 128e3,
|
|
5851
|
+
supportsStructuredOutput: true,
|
|
5852
|
+
rejectsSamplingParameters: true,
|
|
5853
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5854
|
+
rejectsThinkingDisabled: false,
|
|
5855
|
+
rejectsBudgetThinking: true,
|
|
5856
|
+
rejectsForcedToolUse: false,
|
|
5857
|
+
supportsBetweenToolsThinking: false,
|
|
5858
|
+
isKnownModel: true
|
|
5859
|
+
};
|
|
5795
5860
|
} else if (modelId.includes("claude-opus-5")) {
|
|
5796
5861
|
return {
|
|
5797
5862
|
maxOutputTokens: 128e3,
|
|
@@ -5799,6 +5864,7 @@ function getModelCapabilities(modelId) {
|
|
|
5799
5864
|
rejectsSamplingParameters: true,
|
|
5800
5865
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5801
5866
|
rejectsThinkingDisabled: false,
|
|
5867
|
+
rejectsBudgetThinking: false,
|
|
5802
5868
|
rejectsForcedToolUse: false,
|
|
5803
5869
|
supportsBetweenToolsThinking: false,
|
|
5804
5870
|
isKnownModel: true
|
|
@@ -5810,6 +5876,7 @@ function getModelCapabilities(modelId) {
|
|
|
5810
5876
|
rejectsSamplingParameters: true,
|
|
5811
5877
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5812
5878
|
rejectsThinkingDisabled: true,
|
|
5879
|
+
rejectsBudgetThinking: true,
|
|
5813
5880
|
rejectsForcedToolUse: true,
|
|
5814
5881
|
supportsBetweenToolsThinking: false,
|
|
5815
5882
|
isKnownModel: true
|
|
@@ -5821,6 +5888,7 @@ function getModelCapabilities(modelId) {
|
|
|
5821
5888
|
rejectsSamplingParameters: true,
|
|
5822
5889
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5823
5890
|
rejectsThinkingDisabled: true,
|
|
5891
|
+
rejectsBudgetThinking: true,
|
|
5824
5892
|
rejectsForcedToolUse: false,
|
|
5825
5893
|
supportsBetweenToolsThinking: false,
|
|
5826
5894
|
isKnownModel: true
|
|
@@ -5832,6 +5900,7 @@ function getModelCapabilities(modelId) {
|
|
|
5832
5900
|
rejectsSamplingParameters: true,
|
|
5833
5901
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5834
5902
|
rejectsThinkingDisabled: false,
|
|
5903
|
+
rejectsBudgetThinking: false,
|
|
5835
5904
|
rejectsForcedToolUse: false,
|
|
5836
5905
|
supportsBetweenToolsThinking: false,
|
|
5837
5906
|
isKnownModel: true
|
|
@@ -5843,6 +5912,7 @@ function getModelCapabilities(modelId) {
|
|
|
5843
5912
|
rejectsSamplingParameters: false,
|
|
5844
5913
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5845
5914
|
rejectsThinkingDisabled: false,
|
|
5915
|
+
rejectsBudgetThinking: false,
|
|
5846
5916
|
rejectsForcedToolUse: false,
|
|
5847
5917
|
supportsBetweenToolsThinking: false,
|
|
5848
5918
|
isKnownModel: true
|
|
@@ -5854,6 +5924,7 @@ function getModelCapabilities(modelId) {
|
|
|
5854
5924
|
rejectsSamplingParameters: false,
|
|
5855
5925
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5856
5926
|
rejectsThinkingDisabled: false,
|
|
5927
|
+
rejectsBudgetThinking: false,
|
|
5857
5928
|
rejectsForcedToolUse: false,
|
|
5858
5929
|
supportsBetweenToolsThinking: false,
|
|
5859
5930
|
isKnownModel: true
|
|
@@ -5865,6 +5936,7 @@ function getModelCapabilities(modelId) {
|
|
|
5865
5936
|
rejectsSamplingParameters: false,
|
|
5866
5937
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5867
5938
|
rejectsThinkingDisabled: false,
|
|
5939
|
+
rejectsBudgetThinking: false,
|
|
5868
5940
|
rejectsForcedToolUse: false,
|
|
5869
5941
|
supportsBetweenToolsThinking: false,
|
|
5870
5942
|
isKnownModel: true
|
|
@@ -5876,6 +5948,7 @@ function getModelCapabilities(modelId) {
|
|
|
5876
5948
|
rejectsSamplingParameters: false,
|
|
5877
5949
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5878
5950
|
rejectsThinkingDisabled: false,
|
|
5951
|
+
rejectsBudgetThinking: false,
|
|
5879
5952
|
rejectsForcedToolUse: false,
|
|
5880
5953
|
supportsBetweenToolsThinking: false,
|
|
5881
5954
|
isKnownModel: true
|
|
@@ -5887,6 +5960,7 @@ function getModelCapabilities(modelId) {
|
|
|
5887
5960
|
rejectsSamplingParameters: false,
|
|
5888
5961
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5889
5962
|
rejectsThinkingDisabled: false,
|
|
5963
|
+
rejectsBudgetThinking: false,
|
|
5890
5964
|
rejectsForcedToolUse: false,
|
|
5891
5965
|
supportsBetweenToolsThinking: false,
|
|
5892
5966
|
isKnownModel: true
|
|
@@ -5898,6 +5972,7 @@ function getModelCapabilities(modelId) {
|
|
|
5898
5972
|
rejectsSamplingParameters: false,
|
|
5899
5973
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5900
5974
|
rejectsThinkingDisabled: false,
|
|
5975
|
+
rejectsBudgetThinking: false,
|
|
5901
5976
|
rejectsForcedToolUse: false,
|
|
5902
5977
|
supportsBetweenToolsThinking: false,
|
|
5903
5978
|
isKnownModel: true
|
|
@@ -5909,6 +5984,7 @@ function getModelCapabilities(modelId) {
|
|
|
5909
5984
|
rejectsSamplingParameters: false,
|
|
5910
5985
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5911
5986
|
rejectsThinkingDisabled: false,
|
|
5987
|
+
rejectsBudgetThinking: false,
|
|
5912
5988
|
rejectsForcedToolUse: false,
|
|
5913
5989
|
supportsBetweenToolsThinking: false,
|
|
5914
5990
|
isKnownModel: false
|
|
@@ -5920,6 +5996,7 @@ function getModelCapabilities(modelId) {
|
|
|
5920
5996
|
rejectsSamplingParameters: true,
|
|
5921
5997
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
5922
5998
|
rejectsThinkingDisabled: false,
|
|
5999
|
+
rejectsBudgetThinking: false,
|
|
5923
6000
|
rejectsForcedToolUse: false,
|
|
5924
6001
|
supportsBetweenToolsThinking: false,
|
|
5925
6002
|
isKnownModel: false
|
|
@@ -5931,6 +6008,7 @@ function getModelCapabilities(modelId) {
|
|
|
5931
6008
|
rejectsSamplingParameters: false,
|
|
5932
6009
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
5933
6010
|
rejectsThinkingDisabled: false,
|
|
6011
|
+
rejectsBudgetThinking: false,
|
|
5934
6012
|
rejectsForcedToolUse: false,
|
|
5935
6013
|
supportsBetweenToolsThinking: false,
|
|
5936
6014
|
isKnownModel: false
|