@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/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.99" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -1994,7 +1994,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1994
1994
|
}
|
|
1995
1995
|
}
|
|
1996
1996
|
}
|
|
1997
|
-
messages.push({
|
|
1997
|
+
messages.push({
|
|
1998
|
+
role: "assistant",
|
|
1999
|
+
content: moveToolUseBlocksToEnd(anthropicContent)
|
|
2000
|
+
});
|
|
1998
2001
|
break;
|
|
1999
2002
|
}
|
|
2000
2003
|
default: {
|
|
@@ -2054,6 +2057,27 @@ function groupIntoBlocks(prompt) {
|
|
|
2054
2057
|
}
|
|
2055
2058
|
return blocks;
|
|
2056
2059
|
}
|
|
2060
|
+
function moveToolUseBlocksToEnd(content) {
|
|
2061
|
+
const result = [];
|
|
2062
|
+
let segment = [];
|
|
2063
|
+
function flushSegment() {
|
|
2064
|
+
result.push(
|
|
2065
|
+
...segment.filter((part) => part.type !== "tool_use"),
|
|
2066
|
+
...segment.filter((part) => part.type === "tool_use")
|
|
2067
|
+
);
|
|
2068
|
+
segment = [];
|
|
2069
|
+
}
|
|
2070
|
+
for (const part of content) {
|
|
2071
|
+
if (part.type === "thinking" || part.type === "redacted_thinking") {
|
|
2072
|
+
flushSegment();
|
|
2073
|
+
result.push(part);
|
|
2074
|
+
} else {
|
|
2075
|
+
segment.push(part);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
flushSegment();
|
|
2079
|
+
return result;
|
|
2080
|
+
}
|
|
2057
2081
|
|
|
2058
2082
|
// src/map-anthropic-stop-reason.ts
|
|
2059
2083
|
function mapAnthropicStopReason({
|