@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4729bed: Fix JSON parsing crash when handling Anthropic web_fetch tool error results
|
|
8
|
+
|
|
9
|
+
## 3.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d36fa72: Not sending structured output beta header for json response tool
|
|
14
|
+
|
|
3
15
|
## 3.0.15
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
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
|
});
|
|
@@ -2654,7 +2666,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2654
2666
|
toolChoice: { type: "required" },
|
|
2655
2667
|
disableParallelToolUse: true,
|
|
2656
2668
|
cacheControlValidator,
|
|
2657
|
-
supportsStructuredOutput
|
|
2669
|
+
supportsStructuredOutput: false
|
|
2658
2670
|
} : {
|
|
2659
2671
|
tools: tools != null ? tools : [],
|
|
2660
2672
|
toolChoice,
|