@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.131
4
+
5
+ ### Patch Changes
6
+
7
+ - 8228dfa: Fall back to automatic tool choice with a warning when manual thinking is enabled with a required or named tool choice, avoiding an Anthropic API 400 error. Named tool choices send only the selected tool.
8
+ - Updated dependencies [d5e7d82]
9
+ - @ai-sdk/provider-utils@4.0.59
10
+
11
+ ## 3.0.130
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [604b4d3]
16
+ - @ai-sdk/provider-utils@4.0.58
17
+
3
18
  ## 3.0.129
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils27 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.129" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.131" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -1968,7 +1968,7 @@ async function prepareTools({
1968
1968
  toolWarnings.push({
1969
1969
  type: "unsupported",
1970
1970
  feature: "toolChoice",
1971
- details: `toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
1971
+ details: `toolChoice 'required' is not supported with this model or thinking configuration. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
1972
1972
  });
1973
1973
  return {
1974
1974
  tools: anthropicTools2,
@@ -2001,7 +2001,7 @@ async function prepareTools({
2001
2001
  toolWarnings.push({
2002
2002
  type: "unsupported",
2003
2003
  feature: "toolChoice",
2004
- details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
2004
+ details: `toolChoice 'tool' is not supported with this model or thinking configuration. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
2005
2005
  });
2006
2006
  return {
2007
2007
  tools: anthropicTools2.filter(
@@ -4258,7 +4258,7 @@ var AnthropicMessagesLanguageModel = class {
4258
4258
  supportsStructuredOutput: false,
4259
4259
  supportsStrictTools,
4260
4260
  defaultEagerInputStreaming,
4261
- rejectsForcedToolUse
4261
+ rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
4262
4262
  } : {
4263
4263
  tools: tools != null ? tools : [],
4264
4264
  toolChoice,
@@ -4267,7 +4267,7 @@ var AnthropicMessagesLanguageModel = class {
4267
4267
  supportsStructuredOutput,
4268
4268
  supportsStrictTools,
4269
4269
  defaultEagerInputStreaming,
4270
- rejectsForcedToolUse
4270
+ rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
4271
4271
  }
4272
4272
  );
4273
4273
  const cacheWarnings = cacheControlValidator.getWarnings();