@ai-sdk/anthropic 2.0.98 → 2.0.99
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 +6 -0
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +25 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +25 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@ai-sdk/provider-utils";
|
|
12
12
|
|
|
13
13
|
// src/version.ts
|
|
14
|
-
var VERSION = true ? "2.0.
|
|
14
|
+
var VERSION = true ? "2.0.99" : "0.0.0-test";
|
|
15
15
|
|
|
16
16
|
// src/anthropic-messages-language-model.ts
|
|
17
17
|
import {
|
|
@@ -2020,7 +2020,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
2022
|
}
|
|
2023
|
-
messages.push({
|
|
2023
|
+
messages.push({
|
|
2024
|
+
role: "assistant",
|
|
2025
|
+
content: moveToolUseBlocksToEnd(anthropicContent)
|
|
2026
|
+
});
|
|
2024
2027
|
break;
|
|
2025
2028
|
}
|
|
2026
2029
|
default: {
|
|
@@ -2080,6 +2083,27 @@ function groupIntoBlocks(prompt) {
|
|
|
2080
2083
|
}
|
|
2081
2084
|
return blocks;
|
|
2082
2085
|
}
|
|
2086
|
+
function moveToolUseBlocksToEnd(content) {
|
|
2087
|
+
const result = [];
|
|
2088
|
+
let segment = [];
|
|
2089
|
+
function flushSegment() {
|
|
2090
|
+
result.push(
|
|
2091
|
+
...segment.filter((part) => part.type !== "tool_use"),
|
|
2092
|
+
...segment.filter((part) => part.type === "tool_use")
|
|
2093
|
+
);
|
|
2094
|
+
segment = [];
|
|
2095
|
+
}
|
|
2096
|
+
for (const part of content) {
|
|
2097
|
+
if (part.type === "thinking" || part.type === "redacted_thinking") {
|
|
2098
|
+
flushSegment();
|
|
2099
|
+
result.push(part);
|
|
2100
|
+
} else {
|
|
2101
|
+
segment.push(part);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
flushSegment();
|
|
2105
|
+
return result;
|
|
2106
|
+
}
|
|
2083
2107
|
|
|
2084
2108
|
// src/map-anthropic-stop-reason.ts
|
|
2085
2109
|
function mapAnthropicStopReason({
|