@ai-sdk/anthropic 3.0.15 → 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 +12 -0
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +16 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -1574,7 +1574,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1574
1574
|
cacheControlValidator,
|
|
1575
1575
|
toolNameMapping
|
|
1576
1576
|
}) {
|
|
1577
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1577
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
1578
1578
|
const betas = /* @__PURE__ */ new Set();
|
|
1579
1579
|
const blocks = groupIntoBlocks(prompt);
|
|
1580
1580
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2127,13 +2127,25 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2127
2127
|
if (providerToolName === "web_fetch") {
|
|
2128
2128
|
const output = part.output;
|
|
2129
2129
|
if (output.type === "error-json") {
|
|
2130
|
-
|
|
2130
|
+
let errorValue = {};
|
|
2131
|
+
try {
|
|
2132
|
+
if (typeof output.value === "string") {
|
|
2133
|
+
errorValue = JSON.parse(output.value);
|
|
2134
|
+
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2135
|
+
errorValue = output.value;
|
|
2136
|
+
}
|
|
2137
|
+
} catch (e) {
|
|
2138
|
+
const extractedErrorCode = (_p = output.value) == null ? void 0 : _p.errorCode;
|
|
2139
|
+
errorValue = {
|
|
2140
|
+
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unknown"
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2131
2143
|
anthropicContent.push({
|
|
2132
2144
|
type: "web_fetch_tool_result",
|
|
2133
2145
|
tool_use_id: part.toolCallId,
|
|
2134
2146
|
content: {
|
|
2135
2147
|
type: "web_fetch_tool_result_error",
|
|
2136
|
-
error_code: errorValue.errorCode
|
|
2148
|
+
error_code: (_q = errorValue.errorCode) != null ? _q : "unknown"
|
|
2137
2149
|
},
|
|
2138
2150
|
cache_control: cacheControl
|
|
2139
2151
|
});
|
|
@@ -2662,7 +2674,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2662
2674
|
toolChoice: { type: "required" },
|
|
2663
2675
|
disableParallelToolUse: true,
|
|
2664
2676
|
cacheControlValidator,
|
|
2665
|
-
supportsStructuredOutput
|
|
2677
|
+
supportsStructuredOutput: false
|
|
2666
2678
|
} : {
|
|
2667
2679
|
tools: tools != null ? tools : [],
|
|
2668
2680
|
toolChoice,
|