@ai-sdk/anthropic 3.0.128 → 3.0.129
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 +7 -0
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +19 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +19 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +1 -0
- package/src/anthropic-prepare-tools.ts +6 -2
- package/src/convert-to-anthropic-messages-prompt.ts +24 -0
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
14
|
// src/version.ts
|
|
15
|
-
var VERSION = true ? "3.0.
|
|
15
|
+
var VERSION = true ? "3.0.129" : "0.0.0-test";
|
|
16
16
|
|
|
17
17
|
// src/anthropic-messages-language-model.ts
|
|
18
18
|
import {
|
|
@@ -2020,7 +2020,12 @@ async function prepareTools({
|
|
|
2020
2020
|
betas
|
|
2021
2021
|
};
|
|
2022
2022
|
case "none":
|
|
2023
|
-
return {
|
|
2023
|
+
return {
|
|
2024
|
+
tools: anthropicTools2,
|
|
2025
|
+
toolChoice: { type: "none" },
|
|
2026
|
+
toolWarnings,
|
|
2027
|
+
betas
|
|
2028
|
+
};
|
|
2024
2029
|
case "tool":
|
|
2025
2030
|
if (rejectsForcedToolUse) {
|
|
2026
2031
|
toolWarnings.push({
|
|
@@ -2495,7 +2500,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2495
2500
|
toolNameMapping,
|
|
2496
2501
|
toolsetNames = {}
|
|
2497
2502
|
}) {
|
|
2498
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
2503
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2499
2504
|
const betas = /* @__PURE__ */ new Set();
|
|
2500
2505
|
const blocks = groupIntoBlocks(prompt);
|
|
2501
2506
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -3307,6 +3312,18 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
3307
3312
|
}
|
|
3308
3313
|
if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
|
|
3309
3314
|
const output = part.output;
|
|
3315
|
+
if (output.type === "error-json" || output.type === "json" && output.value != null && typeof output.value === "object" && !Array.isArray(output.value) && "type" in output.value && output.value.type === "tool_search_tool_result_error") {
|
|
3316
|
+
anthropicContent.push({
|
|
3317
|
+
type: "tool_search_tool_result",
|
|
3318
|
+
tool_use_id: part.toolCallId,
|
|
3319
|
+
content: {
|
|
3320
|
+
type: "tool_search_tool_result_error",
|
|
3321
|
+
error_code: (_v = (await extractErrorValue(output.value)).errorCode) != null ? _v : "unavailable"
|
|
3322
|
+
},
|
|
3323
|
+
cache_control: cacheControl
|
|
3324
|
+
});
|
|
3325
|
+
break;
|
|
3326
|
+
}
|
|
3310
3327
|
if (output.type !== "json") {
|
|
3311
3328
|
warnings.push({
|
|
3312
3329
|
type: "other",
|