@ai-sdk/anthropic 4.0.26 → 4.0.28
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 +17 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +13 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-anthropic-prompt.ts +19 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9337ecd: Preserve Anthropic prompt-cache matches by replaying complete code-execution transcripts in their original wire shape.
|
|
8
|
+
- Updated dependencies [79e133c]
|
|
9
|
+
- @ai-sdk/provider@4.0.5
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.19
|
|
11
|
+
|
|
12
|
+
## 4.0.27
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [5fc7da5]
|
|
17
|
+
- Updated dependencies [93b2acd]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.18
|
|
19
|
+
|
|
3
20
|
## 4.0.26
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -2938,15 +2938,16 @@ async function convertToAnthropicPrompt({
|
|
|
2938
2938
|
cache_control: cacheControl
|
|
2939
2939
|
});
|
|
2940
2940
|
} else if (
|
|
2941
|
-
// code execution
|
|
2941
|
+
// code execution subtools:
|
|
2942
2942
|
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")
|
|
2943
2943
|
) {
|
|
2944
|
+
const { type: codeExecutionType, ...inputWithoutType } = part.input;
|
|
2944
2945
|
anthropicContent.push({
|
|
2945
2946
|
type: "server_tool_use",
|
|
2946
2947
|
id: part.toolCallId,
|
|
2947
|
-
name:
|
|
2948
|
+
name: codeExecutionType,
|
|
2948
2949
|
// map back to subtool name
|
|
2949
|
-
input:
|
|
2950
|
+
input: inputWithoutType,
|
|
2950
2951
|
cache_control: cacheControl
|
|
2951
2952
|
});
|
|
2952
2953
|
} else if (
|
|
@@ -3140,7 +3141,15 @@ async function convertToAnthropicPrompt({
|
|
|
3140
3141
|
type: "bash_code_execution_tool_result",
|
|
3141
3142
|
tool_use_id: part.toolCallId,
|
|
3142
3143
|
cache_control: cacheControl,
|
|
3143
|
-
|
|
3144
|
+
// Prompt caching requires stable key ordering:
|
|
3145
|
+
// https://platform.claude.com/docs/en/build-with-claude/prompt-caching#troubleshooting-common-issues
|
|
3146
|
+
content: codeExecutionOutput.type === "bash_code_execution_result" ? {
|
|
3147
|
+
type: codeExecutionOutput.type,
|
|
3148
|
+
stdout: codeExecutionOutput.stdout,
|
|
3149
|
+
stderr: codeExecutionOutput.stderr,
|
|
3150
|
+
return_code: codeExecutionOutput.return_code,
|
|
3151
|
+
content: codeExecutionOutput.content
|
|
3152
|
+
} : codeExecutionOutput
|
|
3144
3153
|
});
|
|
3145
3154
|
} else {
|
|
3146
3155
|
anthropicContent.push({
|
|
@@ -6511,7 +6520,7 @@ var AnthropicSkills = class {
|
|
|
6511
6520
|
};
|
|
6512
6521
|
|
|
6513
6522
|
// src/version.ts
|
|
6514
|
-
var VERSION = true ? "4.0.
|
|
6523
|
+
var VERSION = true ? "4.0.28" : "0.0.0-test";
|
|
6515
6524
|
|
|
6516
6525
|
// src/anthropic-provider.ts
|
|
6517
6526
|
var ANTHROPIC_API_URL = "https://api.anthropic.com";
|