@ai-sdk/anthropic 3.0.16 → 3.0.17
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 +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +15 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +15 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.17" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -1566,7 +1566,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1566
1566
|
cacheControlValidator,
|
|
1567
1567
|
toolNameMapping
|
|
1568
1568
|
}) {
|
|
1569
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1569
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
1570
1570
|
const betas = /* @__PURE__ */ new Set();
|
|
1571
1571
|
const blocks = groupIntoBlocks(prompt);
|
|
1572
1572
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2119,13 +2119,25 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2119
2119
|
if (providerToolName === "web_fetch") {
|
|
2120
2120
|
const output = part.output;
|
|
2121
2121
|
if (output.type === "error-json") {
|
|
2122
|
-
|
|
2122
|
+
let errorValue = {};
|
|
2123
|
+
try {
|
|
2124
|
+
if (typeof output.value === "string") {
|
|
2125
|
+
errorValue = JSON.parse(output.value);
|
|
2126
|
+
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2127
|
+
errorValue = output.value;
|
|
2128
|
+
}
|
|
2129
|
+
} catch (e) {
|
|
2130
|
+
const extractedErrorCode = (_p = output.value) == null ? void 0 : _p.errorCode;
|
|
2131
|
+
errorValue = {
|
|
2132
|
+
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2123
2135
|
anthropicContent.push({
|
|
2124
2136
|
type: "web_fetch_tool_result",
|
|
2125
2137
|
tool_use_id: part.toolCallId,
|
|
2126
2138
|
content: {
|
|
2127
2139
|
type: "web_fetch_tool_result_error",
|
|
2128
|
-
error_code: errorValue.errorCode
|
|
2140
|
+
error_code: (_q = errorValue.errorCode) != null ? _q : "unknown"
|
|
2129
2141
|
},
|
|
2130
2142
|
cache_control: cacheControl
|
|
2131
2143
|
});
|