@ai-sdk/anthropic 3.0.103 → 3.0.105
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 +13 -0
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +12 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -3
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +5 -0
- package/package.json +2 -2
- package/src/convert-to-anthropic-messages-prompt.ts +16 -3
package/docs/05-anthropic.mdx
CHANGED
|
@@ -463,6 +463,11 @@ console.log(reasoning); // reasoning details including redacted reasoning
|
|
|
463
463
|
console.log(text); // text response
|
|
464
464
|
```
|
|
465
465
|
|
|
466
|
+
Anthropic's `max_tokens` limit includes both thinking and final text. To reserve
|
|
467
|
+
room for both, the provider adds `budgetTokens` to `maxOutputTokens` when
|
|
468
|
+
setting `max_tokens`. For known models, the combined value is capped at the
|
|
469
|
+
model's maximum output token limit.
|
|
470
|
+
|
|
466
471
|
See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
|
|
467
472
|
on how to integrate reasoning into your chatbot.
|
|
468
473
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.105",
|
|
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.14",
|
|
40
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
40
|
+
"@ai-sdk/provider-utils": "4.0.41"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -685,11 +685,12 @@ export async function convertToAnthropicMessagesPrompt({
|
|
|
685
685
|
(part.input.type === 'bash_code_execution' ||
|
|
686
686
|
part.input.type === 'text_editor_code_execution')
|
|
687
687
|
) {
|
|
688
|
+
const { type: subtoolName, ...input } = part.input;
|
|
688
689
|
anthropicContent.push({
|
|
689
690
|
type: 'server_tool_use',
|
|
690
691
|
id: part.toolCallId,
|
|
691
|
-
name:
|
|
692
|
-
input
|
|
692
|
+
name: subtoolName, // map back to subtool name
|
|
693
|
+
input,
|
|
693
694
|
cache_control: cacheControl,
|
|
694
695
|
});
|
|
695
696
|
} else if (
|
|
@@ -958,7 +959,19 @@ export async function convertToAnthropicMessagesPrompt({
|
|
|
958
959
|
type: 'bash_code_execution_tool_result',
|
|
959
960
|
tool_use_id: part.toolCallId,
|
|
960
961
|
cache_control: cacheControl,
|
|
961
|
-
|
|
962
|
+
// Prompt caching requires stable key ordering:
|
|
963
|
+
// https://platform.claude.com/docs/en/build-with-claude/prompt-caching#troubleshooting-common-issues
|
|
964
|
+
content:
|
|
965
|
+
codeExecutionOutput.type ===
|
|
966
|
+
'bash_code_execution_result'
|
|
967
|
+
? {
|
|
968
|
+
type: codeExecutionOutput.type,
|
|
969
|
+
stdout: codeExecutionOutput.stdout,
|
|
970
|
+
stderr: codeExecutionOutput.stderr,
|
|
971
|
+
return_code: codeExecutionOutput.return_code,
|
|
972
|
+
content: codeExecutionOutput.content,
|
|
973
|
+
}
|
|
974
|
+
: codeExecutionOutput,
|
|
962
975
|
});
|
|
963
976
|
} else {
|
|
964
977
|
anthropicContent.push({
|