@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.
@@ -946,7 +946,7 @@ declare class CacheControlValidator {
946
946
  getWarnings(): SharedV3Warning[];
947
947
  }
948
948
 
949
- declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, }: {
949
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, }: {
950
950
  tools: LanguageModelV3CallOptions['tools'];
951
951
  toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
952
952
  disableParallelToolUse?: boolean;
@@ -959,6 +959,11 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
959
959
  * Whether the model supports strict mode on tool definitions.
960
960
  */
961
961
  supportsStrictTools: boolean;
962
+ /**
963
+ * Default for `eager_input_streaming` on function tools that do not set
964
+ * it explicitly. Driven by the model-level `toolStreaming` option.
965
+ */
966
+ defaultEagerInputStreaming?: boolean;
962
967
  }): Promise<{
963
968
  tools: Array<AnthropicTool> | undefined;
964
969
  toolChoice: AnthropicToolChoice | undefined;
@@ -946,7 +946,7 @@ declare class CacheControlValidator {
946
946
  getWarnings(): SharedV3Warning[];
947
947
  }
948
948
 
949
- declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, }: {
949
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, }: {
950
950
  tools: LanguageModelV3CallOptions['tools'];
951
951
  toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
952
952
  disableParallelToolUse?: boolean;
@@ -959,6 +959,11 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
959
959
  * Whether the model supports strict mode on tool definitions.
960
960
  */
961
961
  supportsStrictTools: boolean;
962
+ /**
963
+ * Default for `eager_input_streaming` on function tools that do not set
964
+ * it explicitly. Driven by the model-level `toolStreaming` option.
965
+ */
966
+ defaultEagerInputStreaming?: boolean;
962
967
  }): Promise<{
963
968
  tools: Array<AnthropicTool> | undefined;
964
969
  toolChoice: AnthropicToolChoice | undefined;
@@ -912,10 +912,11 @@ var anthropicLanguageModelOptions = import_v43.z.object({
912
912
  ).optional()
913
913
  }).optional(),
914
914
  /**
915
- * Whether to enable tool streaming (and structured output streaming).
916
- *
917
- * When set to false, the model will return all tool calls and results
918
- * at once after a delay.
915
+ * Whether to enable fine-grained (eager) streaming of tool call inputs
916
+ * and structured outputs for every function tool in the request. When
917
+ * true (the default), each function tool receives a default of
918
+ * `eager_input_streaming: true` unless it explicitly sets
919
+ * `providerOptions.anthropic.eagerInputStreaming`.
919
920
  *
920
921
  * @default true
921
922
  */
@@ -1303,9 +1304,10 @@ async function prepareTools({
1303
1304
  disableParallelToolUse,
1304
1305
  cacheControlValidator,
1305
1306
  supportsStructuredOutput,
1306
- supportsStrictTools
1307
+ supportsStrictTools,
1308
+ defaultEagerInputStreaming = false
1307
1309
  }) {
1308
- var _a;
1310
+ var _a, _b;
1309
1311
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
1310
1312
  const toolWarnings = [];
1311
1313
  const betas = /* @__PURE__ */ new Set();
@@ -1322,7 +1324,7 @@ async function prepareTools({
1322
1324
  canCache: true
1323
1325
  });
1324
1326
  const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
1325
- const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1327
+ const eagerInputStreaming = (_b = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming) != null ? _b : defaultEagerInputStreaming;
1326
1328
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1327
1329
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1328
1330
  if (!supportsStrictTools && tool.strict != null) {
@@ -3267,9 +3269,7 @@ var AnthropicMessagesLanguageModel = class {
3267
3269
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3268
3270
  betas.add("fast-mode-2026-02-01");
3269
3271
  }
3270
- if (stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true)) {
3271
- betas.add("fine-grained-tool-streaming-2025-05-14");
3272
- }
3272
+ const defaultEagerInputStreaming = stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true);
3273
3273
  const {
3274
3274
  tools: anthropicTools2,
3275
3275
  toolChoice: anthropicToolChoice,
@@ -3282,14 +3282,16 @@ var AnthropicMessagesLanguageModel = class {
3282
3282
  disableParallelToolUse: true,
3283
3283
  cacheControlValidator,
3284
3284
  supportsStructuredOutput: false,
3285
- supportsStrictTools
3285
+ supportsStrictTools,
3286
+ defaultEagerInputStreaming
3286
3287
  } : {
3287
3288
  tools: tools != null ? tools : [],
3288
3289
  toolChoice,
3289
3290
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3290
3291
  cacheControlValidator,
3291
3292
  supportsStructuredOutput,
3292
- supportsStrictTools
3293
+ supportsStrictTools,
3294
+ defaultEagerInputStreaming
3293
3295
  }
3294
3296
  );
3295
3297
  const cacheWarnings = cacheControlValidator.getWarnings();