@ai-sdk/anthropic 3.0.89 → 3.0.91

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.
@@ -191,7 +191,7 @@ const result = streamText({
191
191
 
192
192
  ### Effort
193
193
 
194
- Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7` additionally supports `xhigh` for maximum reasoning effort.
194
+ Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7` and `claude-sonnet-5` additionally support `xhigh` for maximum reasoning effort.
195
195
 
196
196
  ```ts highlight="8-10"
197
197
  import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
@@ -1559,6 +1559,7 @@ and the `mediaType` should be set to `'application/pdf'`.
1559
1559
 
1560
1560
  | Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
1561
1561
  | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
1562
+ | `claude-sonnet-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1562
1563
  | `claude-fable-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1563
1564
  | `claude-opus-4-8` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1564
1565
  | `claude-opus-4-7` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "3.0.89",
3
+ "version": "3.0.91",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -36,8 +36,8 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@ai-sdk/provider": "3.0.12",
40
- "@ai-sdk/provider-utils": "4.0.33"
39
+ "@ai-sdk/provider-utils": "4.0.34",
40
+ "@ai-sdk/provider": "3.0.13"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -1442,6 +1442,7 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1442
1442
  providerExecuted?: boolean;
1443
1443
  firstDelta: boolean;
1444
1444
  providerToolName?: string;
1445
+ providerToolInputType?: string;
1445
1446
  caller?: {
1446
1447
  type:
1447
1448
  | 'code_execution_20250825'
@@ -1647,6 +1648,13 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1647
1648
  part.name === 'bash_code_execution'
1648
1649
  ? 'code_execution'
1649
1650
  : part.name;
1651
+ const providerToolInputType =
1652
+ part.name === 'text_editor_code_execution' ||
1653
+ part.name === 'bash_code_execution'
1654
+ ? part.name
1655
+ : part.name === 'code_execution'
1656
+ ? 'programmatic-tool-call'
1657
+ : undefined;
1650
1658
 
1651
1659
  const customToolName =
1652
1660
  toolNameMapping.toCustomToolName(providerToolName);
@@ -1675,8 +1683,9 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1675
1683
  providerToolName === 'code_execution'
1676
1684
  ? { dynamic: true }
1677
1685
  : {}),
1678
- firstDelta: true,
1686
+ firstDelta: finalInput.length === 0,
1679
1687
  providerToolName,
1688
+ providerToolInputType,
1680
1689
  };
1681
1690
 
1682
1691
  controller.enqueue({
@@ -2205,9 +2214,9 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
2205
2214
  // the type to the delta and change the tool name.
2206
2215
  if (
2207
2216
  contentBlock.firstDelta &&
2208
- contentBlock.providerToolName === 'code_execution'
2217
+ contentBlock.providerToolInputType != null
2209
2218
  ) {
2210
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
2219
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
2211
2220
  }
2212
2221
 
2213
2222
  controller.enqueue({
@@ -2528,7 +2537,8 @@ function getModelCapabilities(modelId: string): {
2528
2537
  if (
2529
2538
  modelId.includes('claude-opus-4-8') ||
2530
2539
  modelId.includes('claude-opus-4-7') ||
2531
- modelId.includes('claude-fable-5')
2540
+ modelId.includes('claude-fable-5') ||
2541
+ modelId.includes('claude-sonnet-5')
2532
2542
  ) {
2533
2543
  return {
2534
2544
  maxOutputTokens: 128000,
@@ -20,6 +20,7 @@ export type AnthropicMessagesModelId =
20
20
  | 'claude-opus-4-7'
21
21
  | 'claude-opus-4-8'
22
22
  | 'claude-fable-5'
23
+ | 'claude-sonnet-5'
23
24
  | (string & {});
24
25
 
25
26
  /**