@ai-sdk/anthropic 3.0.70 → 3.0.71
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 +6 -0
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -13
- 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 +14 -12
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -12
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-language-model.ts +4 -4
- package/src/anthropic-messages-options.ts +5 -4
- package/src/anthropic-prepare-tools.ts +11 -2
package/package.json
CHANGED
|
@@ -663,10 +663,8 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
663
663
|
betas.add('fast-mode-2026-02-01');
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
-
|
|
667
|
-
|
|
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
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
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
|
-
|
|
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
|
|