@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.105
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0a295e3: Preserve Anthropic prompt-cache matches by replaying complete code-execution transcripts in their original wire shape.
|
|
8
|
+
|
|
9
|
+
## 3.0.104
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [9ecdefe]
|
|
14
|
+
- @ai-sdk/provider-utils@4.0.41
|
|
15
|
+
|
|
3
16
|
## 3.0.103
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.105" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -2686,12 +2686,13 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2686
2686
|
// code execution 20250825:
|
|
2687
2687
|
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")
|
|
2688
2688
|
) {
|
|
2689
|
+
const { type: subtoolName, ...input } = part.input;
|
|
2689
2690
|
anthropicContent.push({
|
|
2690
2691
|
type: "server_tool_use",
|
|
2691
2692
|
id: part.toolCallId,
|
|
2692
|
-
name:
|
|
2693
|
+
name: subtoolName,
|
|
2693
2694
|
// map back to subtool name
|
|
2694
|
-
input
|
|
2695
|
+
input,
|
|
2695
2696
|
cache_control: cacheControl
|
|
2696
2697
|
});
|
|
2697
2698
|
} else if (
|
|
@@ -2885,7 +2886,15 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2885
2886
|
type: "bash_code_execution_tool_result",
|
|
2886
2887
|
tool_use_id: part.toolCallId,
|
|
2887
2888
|
cache_control: cacheControl,
|
|
2888
|
-
|
|
2889
|
+
// Prompt caching requires stable key ordering:
|
|
2890
|
+
// https://platform.claude.com/docs/en/build-with-claude/prompt-caching#troubleshooting-common-issues
|
|
2891
|
+
content: codeExecutionOutput.type === "bash_code_execution_result" ? {
|
|
2892
|
+
type: codeExecutionOutput.type,
|
|
2893
|
+
stdout: codeExecutionOutput.stdout,
|
|
2894
|
+
stderr: codeExecutionOutput.stderr,
|
|
2895
|
+
return_code: codeExecutionOutput.return_code,
|
|
2896
|
+
content: codeExecutionOutput.content
|
|
2897
|
+
} : codeExecutionOutput
|
|
2889
2898
|
});
|
|
2890
2899
|
} else {
|
|
2891
2900
|
anthropicContent.push({
|