@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.
@@ -899,10 +899,11 @@ var anthropicLanguageModelOptions = z3.object({
899
899
  ).optional()
900
900
  }).optional(),
901
901
  /**
902
- * Whether to enable tool streaming (and structured output streaming).
903
- *
904
- * When set to false, the model will return all tool calls and results
905
- * at once after a delay.
902
+ * Whether to enable fine-grained (eager) streaming of tool call inputs
903
+ * and structured outputs for every function tool in the request. When
904
+ * true (the default), each function tool receives a default of
905
+ * `eager_input_streaming: true` unless it explicitly sets
906
+ * `providerOptions.anthropic.eagerInputStreaming`.
906
907
  *
907
908
  * @default true
908
909
  */
@@ -1308,9 +1309,10 @@ async function prepareTools({
1308
1309
  disableParallelToolUse,
1309
1310
  cacheControlValidator,
1310
1311
  supportsStructuredOutput,
1311
- supportsStrictTools
1312
+ supportsStrictTools,
1313
+ defaultEagerInputStreaming = false
1312
1314
  }) {
1313
- var _a;
1315
+ var _a, _b;
1314
1316
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
1315
1317
  const toolWarnings = [];
1316
1318
  const betas = /* @__PURE__ */ new Set();
@@ -1327,7 +1329,7 @@ async function prepareTools({
1327
1329
  canCache: true
1328
1330
  });
1329
1331
  const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
1330
- const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
1332
+ const eagerInputStreaming = (_b = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming) != null ? _b : defaultEagerInputStreaming;
1331
1333
  const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1332
1334
  const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1333
1335
  if (!supportsStrictTools && tool.strict != null) {
@@ -3296,9 +3298,7 @@ var AnthropicMessagesLanguageModel = class {
3296
3298
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3297
3299
  betas.add("fast-mode-2026-02-01");
3298
3300
  }
3299
- if (stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true)) {
3300
- betas.add("fine-grained-tool-streaming-2025-05-14");
3301
- }
3301
+ const defaultEagerInputStreaming = stream && ((_i = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _i : true);
3302
3302
  const {
3303
3303
  tools: anthropicTools2,
3304
3304
  toolChoice: anthropicToolChoice,
@@ -3311,14 +3311,16 @@ var AnthropicMessagesLanguageModel = class {
3311
3311
  disableParallelToolUse: true,
3312
3312
  cacheControlValidator,
3313
3313
  supportsStructuredOutput: false,
3314
- supportsStrictTools
3314
+ supportsStrictTools,
3315
+ defaultEagerInputStreaming
3315
3316
  } : {
3316
3317
  tools: tools != null ? tools : [],
3317
3318
  toolChoice,
3318
3319
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
3319
3320
  cacheControlValidator,
3320
3321
  supportsStructuredOutput,
3321
- supportsStrictTools
3322
+ supportsStrictTools,
3323
+ defaultEagerInputStreaming
3322
3324
  }
3323
3325
  );
3324
3326
  const cacheWarnings = cacheControlValidator.getWarnings();