@ai-sdk/anthropic 3.0.70 → 3.0.72

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "3.0.70",
3
+ "version": "3.0.72",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -36,15 +36,15 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@ai-sdk/provider": "3.0.8",
40
- "@ai-sdk/provider-utils": "4.0.23"
39
+ "@ai-sdk/provider": "3.0.9",
40
+ "@ai-sdk/provider-utils": "4.0.24"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
44
44
  "tsup": "^8",
45
45
  "typescript": "5.8.3",
46
46
  "zod": "3.25.76",
47
- "@ai-sdk/test-server": "1.0.3",
47
+ "@ai-sdk/test-server": "1.0.4",
48
48
  "@vercel/ai-tsconfig": "0.0.0"
49
49
  },
50
50
  "peerDependencies": {
@@ -59,7 +59,8 @@
59
59
  "homepage": "https://ai-sdk.dev/docs",
60
60
  "repository": {
61
61
  "type": "git",
62
- "url": "git+https://github.com/vercel/ai.git"
62
+ "url": "https://github.com/vercel/ai",
63
+ "directory": "packages/anthropic"
63
64
  },
64
65
  "bugs": {
65
66
  "url": "https://github.com/vercel/ai/issues"
@@ -663,10 +663,8 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
663
663
  betas.add('fast-mode-2026-02-01');
664
664
  }
665
665
 
666
- // only when streaming: enable fine-grained tool streaming
667
- if (stream && (anthropicOptions?.toolStreaming ?? true)) {
668
- betas.add('fine-grained-tool-streaming-2025-05-14');
669
- }
666
+ const defaultEagerInputStreaming =
667
+ stream && (anthropicOptions?.toolStreaming ?? true);
670
668
 
671
669
  const {
672
670
  tools: anthropicTools,
@@ -682,6 +680,7 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
682
680
  cacheControlValidator,
683
681
  supportsStructuredOutput: false,
684
682
  supportsStrictTools,
683
+ defaultEagerInputStreaming,
685
684
  }
686
685
  : {
687
686
  tools: tools ?? [],
@@ -690,6 +689,7 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
690
689
  cacheControlValidator,
691
690
  supportsStructuredOutput,
692
691
  supportsStrictTools,
692
+ defaultEagerInputStreaming,
693
693
  },
694
694
  );
695
695
 
@@ -177,10 +177,11 @@ export const anthropicLanguageModelOptions = z.object({
177
177
  .optional(),
178
178
 
179
179
  /**
180
- * Whether to enable tool streaming (and structured output streaming).
181
- *
182
- * When set to false, the model will return all tool calls and results
183
- * at once after a delay.
180
+ * Whether to enable fine-grained (eager) streaming of tool call inputs
181
+ * and structured outputs for every function tool in the request. When
182
+ * true (the default), each function tool receives a default of
183
+ * `eager_input_streaming: true` unless it explicitly sets
184
+ * `providerOptions.anthropic.eagerInputStreaming`.
184
185
  *
185
186
  * @default true
186
187
  */
@@ -27,6 +27,7 @@ export async function prepareTools({
27
27
  cacheControlValidator,
28
28
  supportsStructuredOutput,
29
29
  supportsStrictTools,
30
+ defaultEagerInputStreaming = false,
30
31
  }: {
31
32
  tools: LanguageModelV3CallOptions['tools'];
32
33
  toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
@@ -42,6 +43,12 @@ export async function prepareTools({
42
43
  * Whether the model supports strict mode on tool definitions.
43
44
  */
44
45
  supportsStrictTools: boolean;
46
+
47
+ /**
48
+ * Default for `eager_input_streaming` on function tools that do not set
49
+ * it explicitly. Driven by the model-level `toolStreaming` option.
50
+ */
51
+ defaultEagerInputStreaming?: boolean;
45
52
  }): Promise<{
46
53
  tools: Array<AnthropicTool> | undefined;
47
54
  toolChoice: AnthropicToolChoice | undefined;
@@ -73,8 +80,10 @@ export async function prepareTools({
73
80
  const anthropicOptions = tool.providerOptions?.anthropic as
74
81
  | AnthropicToolOptions
75
82
  | undefined;
76
- // eager_input_streaming is only supported on custom (function) tools
77
- const eagerInputStreaming = anthropicOptions?.eagerInputStreaming;
83
+ // eager_input_streaming is only supported on custom (function) tools.
84
+ // Fall back to the model-level default when the tool doesn't set it.
85
+ const eagerInputStreaming =
86
+ anthropicOptions?.eagerInputStreaming ?? defaultEagerInputStreaming;
78
87
  const deferLoading = anthropicOptions?.deferLoading;
79
88
  const allowedCallers = anthropicOptions?.allowedCallers;
80
89