@ai-sdk/anthropic 3.0.101 → 3.0.103
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 +14 -0
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +174 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -69
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -1
- package/dist/internal/index.d.ts +2 -1
- package/dist/internal/index.js +173 -68
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +173 -68
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +79 -2
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +24 -1
- package/src/anthropic-messages-language-model.ts +54 -4
- package/src/anthropic-messages-options.ts +64 -20
- package/src/convert-anthropic-messages-usage.ts +8 -2
- package/src/convert-to-anthropic-messages-prompt.ts +64 -12
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.103
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7865a71: fix(anthropic): report thinking tokens as reasoning token usage
|
|
8
|
+
|
|
9
|
+
## 3.0.102
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b4c4426: feat (provider/anthropic): support fallbacks 'default' mode, which routes safety classifier refusals to Anthropic's recommended fallback model (adds the server-side-fallback-2026-07-01 beta automatically)
|
|
14
|
+
- b4c4426: feat (provider/anthropic): support mid-conversation tool changes via the toolChanges system message provider option, emitting tool_addition/tool_removal content blocks and the mid-conversation-tool-changes-2026-07-01 beta
|
|
15
|
+
- b4c4426: feat (provider/anthropic): add claude-opus-5 model id with frontier-tier capabilities (128k output tokens, structured output, adaptive thinking, xhigh effort, sampling parameter rejection, thinking-disabled only at effort high or below)
|
|
16
|
+
|
|
3
17
|
## 3.0.101
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -184,7 +184,20 @@ interface AnthropicMessageMetadata {
|
|
|
184
184
|
} | null;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
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-fable-5' | 'claude-sonnet-5' | (string & {});
|
|
187
|
+
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-fable-5' | 'claude-sonnet-5' | (string & {});
|
|
188
|
+
/**
|
|
189
|
+
* Anthropic provider options for system messages.
|
|
190
|
+
*/
|
|
191
|
+
declare const anthropicSystemMessageProviderOptions: z.ZodObject<{
|
|
192
|
+
toolChanges: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"tool_addition">;
|
|
194
|
+
toolName: z.ZodString;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"tool_removal">;
|
|
197
|
+
toolName: z.ZodString;
|
|
198
|
+
}, z.core.$strip>]>>>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
type AnthropicSystemMessageProviderOptions = z.infer<typeof anthropicSystemMessageProviderOptions>;
|
|
188
201
|
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
189
202
|
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
190
203
|
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -251,7 +264,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
251
264
|
us: "us";
|
|
252
265
|
global: "global";
|
|
253
266
|
}>>;
|
|
254
|
-
fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
267
|
+
fallbacks: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"default">, z.ZodArray<z.ZodObject<{
|
|
255
268
|
model: z.ZodString;
|
|
256
269
|
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
257
270
|
thinking: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -260,7 +273,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
260
273
|
fast: "fast";
|
|
261
274
|
standard: "standard";
|
|
262
275
|
}>>;
|
|
263
|
-
}, z.core.$strip
|
|
276
|
+
}, z.core.$strip>>]>>;
|
|
264
277
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
265
278
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
266
279
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1224,4 +1237,4 @@ declare function forwardAnthropicContainerIdFromLastStep({ steps, }: {
|
|
|
1224
1237
|
|
|
1225
1238
|
declare const VERSION: string;
|
|
1226
1239
|
|
|
1227
|
-
export { type AnthropicLanguageModelOptions, type AnthropicMessageMetadata, type AnthropicProvider, type AnthropicLanguageModelOptions as AnthropicProviderOptions, type AnthropicProviderSettings, type AnthropicToolOptions, type AnthropicUsageIteration, VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
|
|
1240
|
+
export { type AnthropicLanguageModelOptions, type AnthropicMessageMetadata, type AnthropicProvider, type AnthropicLanguageModelOptions as AnthropicProviderOptions, type AnthropicProviderSettings, type AnthropicSystemMessageProviderOptions, type AnthropicToolOptions, type AnthropicUsageIteration, VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
|
package/dist/index.d.ts
CHANGED
|
@@ -184,7 +184,20 @@ interface AnthropicMessageMetadata {
|
|
|
184
184
|
} | null;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
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-fable-5' | 'claude-sonnet-5' | (string & {});
|
|
187
|
+
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-fable-5' | 'claude-sonnet-5' | (string & {});
|
|
188
|
+
/**
|
|
189
|
+
* Anthropic provider options for system messages.
|
|
190
|
+
*/
|
|
191
|
+
declare const anthropicSystemMessageProviderOptions: z.ZodObject<{
|
|
192
|
+
toolChanges: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"tool_addition">;
|
|
194
|
+
toolName: z.ZodString;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"tool_removal">;
|
|
197
|
+
toolName: z.ZodString;
|
|
198
|
+
}, z.core.$strip>]>>>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
type AnthropicSystemMessageProviderOptions = z.infer<typeof anthropicSystemMessageProviderOptions>;
|
|
188
201
|
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
189
202
|
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
190
203
|
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -251,7 +264,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
251
264
|
us: "us";
|
|
252
265
|
global: "global";
|
|
253
266
|
}>>;
|
|
254
|
-
fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
267
|
+
fallbacks: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"default">, z.ZodArray<z.ZodObject<{
|
|
255
268
|
model: z.ZodString;
|
|
256
269
|
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
257
270
|
thinking: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -260,7 +273,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
260
273
|
fast: "fast";
|
|
261
274
|
standard: "standard";
|
|
262
275
|
}>>;
|
|
263
|
-
}, z.core.$strip
|
|
276
|
+
}, z.core.$strip>>]>>;
|
|
264
277
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
265
278
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
266
279
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1224,4 +1237,4 @@ declare function forwardAnthropicContainerIdFromLastStep({ steps, }: {
|
|
|
1224
1237
|
|
|
1225
1238
|
declare const VERSION: string;
|
|
1226
1239
|
|
|
1227
|
-
export { type AnthropicLanguageModelOptions, type AnthropicMessageMetadata, type AnthropicProvider, type AnthropicLanguageModelOptions as AnthropicProviderOptions, type AnthropicProviderSettings, type AnthropicToolOptions, type AnthropicUsageIteration, VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
|
|
1240
|
+
export { type AnthropicLanguageModelOptions, type AnthropicMessageMetadata, type AnthropicProvider, type AnthropicLanguageModelOptions as AnthropicProviderOptions, type AnthropicProviderSettings, type AnthropicSystemMessageProviderOptions, type AnthropicToolOptions, type AnthropicUsageIteration, VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
|