@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.
@@ -1082,6 +1082,8 @@ type AnthropicTool = {
1082
1082
  type AnthropicToolChoice = {
1083
1083
  type: 'auto' | 'any';
1084
1084
  disable_parallel_tool_use?: boolean;
1085
+ } | {
1086
+ type: 'none';
1085
1087
  } | {
1086
1088
  type: 'tool';
1087
1089
  name: string;
@@ -1082,6 +1082,8 @@ type AnthropicTool = {
1082
1082
  type AnthropicToolChoice = {
1083
1083
  type: 'auto' | 'any';
1084
1084
  disable_parallel_tool_use?: boolean;
1085
+ } | {
1086
+ type: 'none';
1085
1087
  } | {
1086
1088
  type: 'tool';
1087
1089
  name: string;
@@ -1984,7 +1984,12 @@ async function prepareTools({
1984
1984
  betas
1985
1985
  };
1986
1986
  case "none":
1987
- return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
1987
+ return {
1988
+ tools: anthropicTools2,
1989
+ toolChoice: { type: "none" },
1990
+ toolWarnings,
1991
+ betas
1992
+ };
1988
1993
  case "tool":
1989
1994
  if (rejectsForcedToolUse) {
1990
1995
  toolWarnings.push({
@@ -2433,7 +2438,7 @@ async function convertToAnthropicMessagesPrompt({
2433
2438
  toolNameMapping,
2434
2439
  toolsetNames = {}
2435
2440
  }) {
2436
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2437
2442
  const betas = /* @__PURE__ */ new Set();
2438
2443
  const blocks = groupIntoBlocks(prompt);
2439
2444
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -3245,6 +3250,18 @@ async function convertToAnthropicMessagesPrompt({
3245
3250
  }
3246
3251
  if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
3247
3252
  const output = part.output;
3253
+ 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") {
3254
+ anthropicContent.push({
3255
+ type: "tool_search_tool_result",
3256
+ tool_use_id: part.toolCallId,
3257
+ content: {
3258
+ type: "tool_search_tool_result_error",
3259
+ error_code: (_v = (await extractErrorValue(output.value)).errorCode) != null ? _v : "unavailable"
3260
+ },
3261
+ cache_control: cacheControl
3262
+ });
3263
+ break;
3264
+ }
3248
3265
  if (output.type !== "json") {
3249
3266
  warnings.push({
3250
3267
  type: "other",