@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/dist/internal/index.js
CHANGED
|
@@ -1558,7 +1558,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1558
1558
|
cacheControlValidator,
|
|
1559
1559
|
toolNameMapping
|
|
1560
1560
|
}) {
|
|
1561
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1561
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
1562
1562
|
const betas = /* @__PURE__ */ new Set();
|
|
1563
1563
|
const blocks = groupIntoBlocks(prompt);
|
|
1564
1564
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2111,13 +2111,25 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2111
2111
|
if (providerToolName === "web_fetch") {
|
|
2112
2112
|
const output = part.output;
|
|
2113
2113
|
if (output.type === "error-json") {
|
|
2114
|
-
|
|
2114
|
+
let errorValue = {};
|
|
2115
|
+
try {
|
|
2116
|
+
if (typeof output.value === "string") {
|
|
2117
|
+
errorValue = JSON.parse(output.value);
|
|
2118
|
+
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2119
|
+
errorValue = output.value;
|
|
2120
|
+
}
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
const extractedErrorCode = (_p = output.value) == null ? void 0 : _p.errorCode;
|
|
2123
|
+
errorValue = {
|
|
2124
|
+
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2115
2127
|
anthropicContent.push({
|
|
2116
2128
|
type: "web_fetch_tool_result",
|
|
2117
2129
|
tool_use_id: part.toolCallId,
|
|
2118
2130
|
content: {
|
|
2119
2131
|
type: "web_fetch_tool_result_error",
|
|
2120
|
-
error_code: errorValue.errorCode
|
|
2132
|
+
error_code: (_q = errorValue.errorCode) != null ? _q : "unknown"
|
|
2121
2133
|
},
|
|
2122
2134
|
cache_control: cacheControl
|
|
2123
2135
|
});
|