@ai-sdk/anthropic 3.0.129 → 3.0.131

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.
@@ -695,6 +695,13 @@ room for both, the provider adds `budgetTokens` to `maxOutputTokens` when
695
695
  setting `max_tokens`. For known models, the combined value is capped at the
696
696
  model's maximum output token limit.
697
697
 
698
+ With manual thinking (`thinking.type: 'enabled'`), a `required` or named
699
+ `toolChoice` falls back to `auto` with a warning. For a named tool choice, only
700
+ the selected tool is sent. This also applies when the top-level `reasoning`
701
+ option enables manual thinking, including when structured output uses the
702
+ internal JSON response tool. Tool use is no longer guaranteed: instruct the
703
+ model to use the tool in your prompt and verify that a tool call was made.
704
+
698
705
  See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
699
706
  on how to integrate reasoning into your chatbot.
700
707
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "3.0.129",
3
+ "version": "3.0.131",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@ai-sdk/provider": "3.0.18",
40
- "@ai-sdk/provider-utils": "4.0.57"
40
+ "@ai-sdk/provider-utils": "4.0.59"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -947,7 +947,8 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
947
947
  supportsStructuredOutput: false,
948
948
  supportsStrictTools,
949
949
  defaultEagerInputStreaming,
950
- rejectsForcedToolUse,
950
+ rejectsForcedToolUse:
951
+ rejectsForcedToolUse || thinkingType === 'enabled',
951
952
  }
952
953
  : {
953
954
  tools: tools ?? [],
@@ -957,7 +958,8 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
957
958
  supportsStructuredOutput,
958
959
  supportsStrictTools,
959
960
  defaultEagerInputStreaming,
960
- rejectsForcedToolUse,
961
+ rejectsForcedToolUse:
962
+ rejectsForcedToolUse || thinkingType === 'enabled',
961
963
  },
962
964
  );
963
965
 
@@ -57,9 +57,9 @@ export async function prepareTools({
57
57
  defaultEagerInputStreaming?: boolean;
58
58
 
59
59
  /**
60
- * Whether the model rejects forced tool use (`tool_choice` `any` or a
61
- * named tool). When true, `required` and `tool` tool choices fall back to
62
- * `auto` with a warning.
60
+ * Whether the model or thinking configuration rejects forced tool use
61
+ * (`tool_choice` `any` or a named tool). When true, `required` and `tool`
62
+ * tool choices fall back to `auto` with a warning.
63
63
  */
64
64
  rejectsForcedToolUse?: boolean;
65
65
  }): Promise<{
@@ -454,7 +454,7 @@ export async function prepareTools({
454
454
  type: 'unsupported',
455
455
  feature: 'toolChoice',
456
456
  details:
457
- `toolChoice 'required' is not supported by this model because it rejects forced tool use. ` +
457
+ `toolChoice 'required' is not supported with this model or thinking configuration. ` +
458
458
  `Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`,
459
459
  });
460
460
  return {
@@ -489,7 +489,7 @@ export async function prepareTools({
489
489
  type: 'unsupported',
490
490
  feature: 'toolChoice',
491
491
  details:
492
- `toolChoice 'tool' is not supported by this model because it rejects forced tool use. ` +
492
+ `toolChoice 'tool' is not supported with this model or thinking configuration. ` +
493
493
  `Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. ` +
494
494
  `Instruct the model to use the tool in the prompt and verify that a tool call was made.`,
495
495
  });