@ai-sdk/anthropic 2.0.106 → 2.0.108

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.
@@ -714,7 +714,7 @@ var anthropicProviderOptions = z3.object({
714
714
  *
715
715
  * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
716
716
  * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
717
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
717
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
718
718
  */
719
719
  structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
720
720
  /**
@@ -727,6 +727,9 @@ var anthropicProviderOptions = z3.object({
727
727
  * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
728
728
  * provider drops the unsupported setting, emits a warning, and sends an
729
729
  * adaptive thinking request. Use `effort` to control how much they think.
730
+ *
731
+ * `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
732
+ * and the provider uses it in place of `disabled` for that model.
730
733
  */
731
734
  thinking: z3.union([
732
735
  z3.object({
@@ -758,6 +761,14 @@ var anthropicProviderOptions = z3.object({
758
761
  z3.object({
759
762
  type: z3.literal("disabled")
760
763
  }),
764
+ z3.object({
765
+ /**
766
+ * for `claude-sonnet-5-5`: no upfront thinking, but progress notes
767
+ * between tool calls are returned as summarized thinking blocks.
768
+ * Only supported at `low`, `medium`, and `high` effort.
769
+ */
770
+ type: z3.literal("between_tools")
771
+ }),
761
772
  z3.object({
762
773
  /**
763
774
  * Configure prefix mismatch handling without changing the model's
@@ -2654,6 +2665,7 @@ var AnthropicMessagesLanguageModel = class {
2654
2665
  rejectsThinkingDisabledAboveHighEffort,
2655
2666
  rejectsThinkingDisabled,
2656
2667
  rejectsForcedToolUse,
2668
+ supportsBetweenToolsThinking,
2657
2669
  isKnownModel
2658
2670
  } = getModelCapabilities(this.modelId);
2659
2671
  if (!isKnownModel && maxOutputTokens == null) {
@@ -2689,7 +2701,7 @@ var AnthropicMessagesLanguageModel = class {
2689
2701
  }
2690
2702
  }
2691
2703
  const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
2692
- const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") ? "auto" : "jsonTool";
2704
+ const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") || this.modelId.includes("claude-sonnet-5-5") ? "auto" : "jsonTool";
2693
2705
  let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2694
2706
  if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
2695
2707
  warnings.push({
@@ -2724,7 +2736,14 @@ var AnthropicMessagesLanguageModel = class {
2724
2736
  });
2725
2737
  if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
2726
2738
  const thinking = anthropicOptions.thinking;
2727
- if ("type" in thinking && thinking.type === "disabled") {
2739
+ if ("type" in thinking && thinking.type === "disabled" && supportsBetweenToolsThinking) {
2740
+ warnings.push({
2741
+ type: "unsupported-setting",
2742
+ setting: "providerOptions.anthropic.thinking",
2743
+ details: `thinking cannot be disabled for ${this.modelId}. Using 'between_tools' thinking, the lowest thinking setting, instead.`
2744
+ });
2745
+ anthropicOptions.thinking = { type: "between_tools" };
2746
+ } else if ("type" in thinking && thinking.type === "disabled") {
2728
2747
  warnings.push({
2729
2748
  type: "unsupported-setting",
2730
2749
  setting: "providerOptions.anthropic.thinking",
@@ -2755,7 +2774,15 @@ var AnthropicMessagesLanguageModel = class {
2755
2774
  });
2756
2775
  anthropicOptions.effort = "high";
2757
2776
  }
2758
- const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
2777
+ if (thinkingType === "between_tools" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
2778
+ warnings.push({
2779
+ type: "unsupported-setting",
2780
+ setting: "providerOptions.anthropic.effort",
2781
+ details: `effort '${anthropicOptions.effort}' is not supported with 'between_tools' thinking. The effort has been lowered to 'high'.`
2782
+ });
2783
+ anthropicOptions.effort = "high";
2784
+ }
2785
+ const isThinking = thinkingType === "enabled" || thinkingType === "adaptive" || thinkingType === "between_tools";
2759
2786
  let thinkingBudget = thinkingOptions != null && "budgetTokens" in thinkingOptions ? thinkingOptions.budgetTokens : void 0;
2760
2787
  const thinkingDisplay = thinkingOptions != null && "display" in thinkingOptions ? thinkingOptions.display : void 0;
2761
2788
  const thinkingBlockBinding = thinkingOptions != null && "blockBinding" in thinkingOptions ? thinkingOptions.blockBinding : void 0;
@@ -4120,7 +4147,18 @@ var AnthropicMessagesLanguageModel = class {
4120
4147
  }
4121
4148
  };
4122
4149
  function getModelCapabilities(modelId) {
4123
- if (modelId.includes("claude-opus-5-5")) {
4150
+ if (modelId.includes("claude-sonnet-5-5")) {
4151
+ return {
4152
+ maxOutputTokens: 128e3,
4153
+ supportsStructuredOutput: true,
4154
+ rejectsSamplingParameters: true,
4155
+ rejectsThinkingDisabledAboveHighEffort: true,
4156
+ rejectsThinkingDisabled: true,
4157
+ rejectsForcedToolUse: true,
4158
+ supportsBetweenToolsThinking: true,
4159
+ isKnownModel: true
4160
+ };
4161
+ } else if (modelId.includes("claude-opus-5-5")) {
4124
4162
  return {
4125
4163
  maxOutputTokens: 128e3,
4126
4164
  supportsStructuredOutput: true,
@@ -4128,6 +4166,7 @@ function getModelCapabilities(modelId) {
4128
4166
  rejectsThinkingDisabledAboveHighEffort: true,
4129
4167
  rejectsThinkingDisabled: true,
4130
4168
  rejectsForcedToolUse: true,
4169
+ supportsBetweenToolsThinking: false,
4131
4170
  isKnownModel: true
4132
4171
  };
4133
4172
  } else if (modelId.includes("claude-opus-5")) {
@@ -4138,6 +4177,7 @@ function getModelCapabilities(modelId) {
4138
4177
  rejectsThinkingDisabledAboveHighEffort: true,
4139
4178
  rejectsThinkingDisabled: false,
4140
4179
  rejectsForcedToolUse: false,
4180
+ supportsBetweenToolsThinking: false,
4141
4181
  isKnownModel: true
4142
4182
  };
4143
4183
  } else if (modelId.includes("claude-fable-5-1")) {
@@ -4148,6 +4188,7 @@ function getModelCapabilities(modelId) {
4148
4188
  rejectsThinkingDisabledAboveHighEffort: false,
4149
4189
  rejectsThinkingDisabled: true,
4150
4190
  rejectsForcedToolUse: true,
4191
+ supportsBetweenToolsThinking: false,
4151
4192
  isKnownModel: true
4152
4193
  };
4153
4194
  } else if (modelId.includes("claude-fable-5")) {
@@ -4158,6 +4199,7 @@ function getModelCapabilities(modelId) {
4158
4199
  rejectsThinkingDisabledAboveHighEffort: false,
4159
4200
  rejectsThinkingDisabled: true,
4160
4201
  rejectsForcedToolUse: false,
4202
+ supportsBetweenToolsThinking: false,
4161
4203
  isKnownModel: true
4162
4204
  };
4163
4205
  } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
@@ -4168,6 +4210,7 @@ function getModelCapabilities(modelId) {
4168
4210
  rejectsThinkingDisabledAboveHighEffort: false,
4169
4211
  rejectsThinkingDisabled: false,
4170
4212
  rejectsForcedToolUse: false,
4213
+ supportsBetweenToolsThinking: false,
4171
4214
  isKnownModel: true
4172
4215
  };
4173
4216
  } else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
@@ -4178,6 +4221,7 @@ function getModelCapabilities(modelId) {
4178
4221
  rejectsThinkingDisabledAboveHighEffort: false,
4179
4222
  rejectsThinkingDisabled: false,
4180
4223
  rejectsForcedToolUse: false,
4224
+ supportsBetweenToolsThinking: false,
4181
4225
  isKnownModel: true
4182
4226
  };
4183
4227
  } else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
@@ -4188,6 +4232,7 @@ function getModelCapabilities(modelId) {
4188
4232
  rejectsThinkingDisabledAboveHighEffort: false,
4189
4233
  rejectsThinkingDisabled: false,
4190
4234
  rejectsForcedToolUse: false,
4235
+ supportsBetweenToolsThinking: false,
4191
4236
  isKnownModel: true
4192
4237
  };
4193
4238
  } else if (modelId.includes("claude-opus-4-1")) {
@@ -4198,6 +4243,7 @@ function getModelCapabilities(modelId) {
4198
4243
  rejectsThinkingDisabledAboveHighEffort: false,
4199
4244
  rejectsThinkingDisabled: false,
4200
4245
  rejectsForcedToolUse: false,
4246
+ supportsBetweenToolsThinking: false,
4201
4247
  isKnownModel: true
4202
4248
  };
4203
4249
  } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
@@ -4208,6 +4254,7 @@ function getModelCapabilities(modelId) {
4208
4254
  rejectsThinkingDisabledAboveHighEffort: false,
4209
4255
  rejectsThinkingDisabled: false,
4210
4256
  rejectsForcedToolUse: false,
4257
+ supportsBetweenToolsThinking: false,
4211
4258
  isKnownModel: true
4212
4259
  };
4213
4260
  } else if (modelId.includes("claude-opus-4-")) {
@@ -4218,6 +4265,7 @@ function getModelCapabilities(modelId) {
4218
4265
  rejectsThinkingDisabledAboveHighEffort: false,
4219
4266
  rejectsThinkingDisabled: false,
4220
4267
  rejectsForcedToolUse: false,
4268
+ supportsBetweenToolsThinking: false,
4221
4269
  isKnownModel: true
4222
4270
  };
4223
4271
  } else if (modelId.includes("claude-3-haiku")) {
@@ -4228,6 +4276,7 @@ function getModelCapabilities(modelId) {
4228
4276
  rejectsThinkingDisabledAboveHighEffort: false,
4229
4277
  rejectsThinkingDisabled: false,
4230
4278
  rejectsForcedToolUse: false,
4279
+ supportsBetweenToolsThinking: false,
4231
4280
  isKnownModel: true
4232
4281
  };
4233
4282
  } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
@@ -4238,6 +4287,7 @@ function getModelCapabilities(modelId) {
4238
4287
  rejectsThinkingDisabledAboveHighEffort: false,
4239
4288
  rejectsThinkingDisabled: false,
4240
4289
  rejectsForcedToolUse: false,
4290
+ supportsBetweenToolsThinking: false,
4241
4291
  isKnownModel: false
4242
4292
  };
4243
4293
  } else if (modelId.includes("claude-")) {
@@ -4248,6 +4298,7 @@ function getModelCapabilities(modelId) {
4248
4298
  rejectsThinkingDisabledAboveHighEffort: true,
4249
4299
  rejectsThinkingDisabled: false,
4250
4300
  rejectsForcedToolUse: false,
4301
+ supportsBetweenToolsThinking: false,
4251
4302
  isKnownModel: false
4252
4303
  };
4253
4304
  } else {
@@ -4258,6 +4309,7 @@ function getModelCapabilities(modelId) {
4258
4309
  rejectsThinkingDisabledAboveHighEffort: false,
4259
4310
  rejectsThinkingDisabled: false,
4260
4311
  rejectsForcedToolUse: false,
4312
+ supportsBetweenToolsThinking: false,
4261
4313
  isKnownModel: false
4262
4314
  };
4263
4315
  }