@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 +15 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +4 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +4 -4
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +7 -0
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +4 -2
- package/src/anthropic-prepare-tools.ts +5 -5
|
@@ -1119,9 +1119,9 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1119
1119
|
*/
|
|
1120
1120
|
defaultEagerInputStreaming?: boolean;
|
|
1121
1121
|
/**
|
|
1122
|
-
* Whether the model rejects forced tool use
|
|
1123
|
-
* named tool). When true, `required` and `tool`
|
|
1124
|
-
* `auto` with a warning.
|
|
1122
|
+
* Whether the model or thinking configuration rejects forced tool use
|
|
1123
|
+
* (`tool_choice` `any` or a named tool). When true, `required` and `tool`
|
|
1124
|
+
* tool choices fall back to `auto` with a warning.
|
|
1125
1125
|
*/
|
|
1126
1126
|
rejectsForcedToolUse?: boolean;
|
|
1127
1127
|
}): Promise<{
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1119,9 +1119,9 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1119
1119
|
*/
|
|
1120
1120
|
defaultEagerInputStreaming?: boolean;
|
|
1121
1121
|
/**
|
|
1122
|
-
* Whether the model rejects forced tool use
|
|
1123
|
-
* named tool). When true, `required` and `tool`
|
|
1124
|
-
* `auto` with a warning.
|
|
1122
|
+
* Whether the model or thinking configuration rejects forced tool use
|
|
1123
|
+
* (`tool_choice` `any` or a named tool). When true, `required` and `tool`
|
|
1124
|
+
* tool choices fall back to `auto` with a warning.
|
|
1125
1125
|
*/
|
|
1126
1126
|
rejectsForcedToolUse?: boolean;
|
|
1127
1127
|
}): Promise<{
|
package/dist/internal/index.js
CHANGED
|
@@ -1962,7 +1962,7 @@ async function prepareTools({
|
|
|
1962
1962
|
toolWarnings.push({
|
|
1963
1963
|
type: "unsupported",
|
|
1964
1964
|
feature: "toolChoice",
|
|
1965
|
-
details: `toolChoice 'required' is not supported
|
|
1965
|
+
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.`
|
|
1966
1966
|
});
|
|
1967
1967
|
return {
|
|
1968
1968
|
tools: anthropicTools2,
|
|
@@ -1995,7 +1995,7 @@ async function prepareTools({
|
|
|
1995
1995
|
toolWarnings.push({
|
|
1996
1996
|
type: "unsupported",
|
|
1997
1997
|
feature: "toolChoice",
|
|
1998
|
-
details: `toolChoice 'tool' is not supported
|
|
1998
|
+
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.`
|
|
1999
1999
|
});
|
|
2000
2000
|
return {
|
|
2001
2001
|
tools: anthropicTools2.filter(
|
|
@@ -4252,7 +4252,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4252
4252
|
supportsStructuredOutput: false,
|
|
4253
4253
|
supportsStrictTools,
|
|
4254
4254
|
defaultEagerInputStreaming,
|
|
4255
|
-
rejectsForcedToolUse
|
|
4255
|
+
rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
|
|
4256
4256
|
} : {
|
|
4257
4257
|
tools: tools != null ? tools : [],
|
|
4258
4258
|
toolChoice,
|
|
@@ -4261,7 +4261,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4261
4261
|
supportsStructuredOutput,
|
|
4262
4262
|
supportsStrictTools,
|
|
4263
4263
|
defaultEagerInputStreaming,
|
|
4264
|
-
rejectsForcedToolUse
|
|
4264
|
+
rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
|
|
4265
4265
|
}
|
|
4266
4266
|
);
|
|
4267
4267
|
const cacheWarnings = cacheControlValidator.getWarnings();
|