@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/dist/internal/index.mjs
CHANGED
|
@@ -2721,12 +2721,13 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2721
2721
|
// code execution 20250825:
|
|
2722
2722
|
providerToolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && typeof part.input.type === "string" && (part.input.type === "bash_code_execution" || part.input.type === "text_editor_code_execution")
|
|
2723
2723
|
) {
|
|
2724
|
+
const { type: subtoolName, ...input } = part.input;
|
|
2724
2725
|
anthropicContent.push({
|
|
2725
2726
|
type: "server_tool_use",
|
|
2726
2727
|
id: part.toolCallId,
|
|
2727
|
-
name:
|
|
2728
|
+
name: subtoolName,
|
|
2728
2729
|
// map back to subtool name
|
|
2729
|
-
input
|
|
2730
|
+
input,
|
|
2730
2731
|
cache_control: cacheControl
|
|
2731
2732
|
});
|
|
2732
2733
|
} else if (
|
|
@@ -2920,7 +2921,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2920
2921
|
type: "bash_code_execution_tool_result",
|
|
2921
2922
|
tool_use_id: part.toolCallId,
|
|
2922
2923
|
cache_control: cacheControl,
|
|
2923
|
-
|
|
2924
|
+
// Prompt caching requires stable key ordering:
|
|
2925
|
+
// https://platform.claude.com/docs/en/build-with-claude/prompt-caching#troubleshooting-common-issues
|
|
2926
|
+
content: codeExecutionOutput.type === "bash_code_execution_result" ? {
|
|
2927
|
+
type: codeExecutionOutput.type,
|
|
2928
|
+
stdout: codeExecutionOutput.stdout,
|
|
2929
|
+
stderr: codeExecutionOutput.stderr,
|
|
2930
|
+
return_code: codeExecutionOutput.return_code,
|
|
2931
|
+
content: codeExecutionOutput.content
|
|
2932
|
+
} : codeExecutionOutput
|
|
2924
2933
|
});
|
|
2925
2934
|
} else {
|
|
2926
2935
|
anthropicContent.push({
|