@ai-sdk/anthropic 2.0.12 → 2.0.13
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 +8 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +8 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +8 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cd458a8: fix(anthropic): reorder tool_result parts to front of combined user messages
|
|
8
|
+
|
|
9
|
+
Reorders tool_result content to appear before user text within combined user messages, ensuring Claude API validation requirements are met while preserving the intentional message combining behavior that prevents role alternation errors. Fixes #8318.
|
|
10
|
+
|
|
3
11
|
## 2.0.12
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -571,7 +571,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
|
|
574
|
+
const toolResultParts = anthropicContent.filter(
|
|
575
|
+
(part) => part.type === "tool_result"
|
|
576
|
+
);
|
|
577
|
+
const otherParts = anthropicContent.filter(
|
|
578
|
+
(part) => part.type !== "tool_result"
|
|
579
|
+
);
|
|
580
|
+
const reorderedContent = toolResultParts.length > 0 ? [...toolResultParts, ...otherParts] : anthropicContent;
|
|
581
|
+
messages.push({ role: "user", content: reorderedContent });
|
|
575
582
|
break;
|
|
576
583
|
}
|
|
577
584
|
case "assistant": {
|