@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.
@@ -2004,7 +2004,12 @@ async function prepareTools({
2004
2004
  betas
2005
2005
  };
2006
2006
  case "none":
2007
- return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
2007
+ return {
2008
+ tools: anthropicTools2,
2009
+ toolChoice: { type: "none" },
2010
+ toolWarnings,
2011
+ betas
2012
+ };
2008
2013
  case "tool":
2009
2014
  if (rejectsForcedToolUse) {
2010
2015
  toolWarnings.push({
@@ -2479,7 +2484,7 @@ async function convertToAnthropicMessagesPrompt({
2479
2484
  toolNameMapping,
2480
2485
  toolsetNames = {}
2481
2486
  }) {
2482
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2483
2488
  const betas = /* @__PURE__ */ new Set();
2484
2489
  const blocks = groupIntoBlocks(prompt);
2485
2490
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -3291,6 +3296,18 @@ async function convertToAnthropicMessagesPrompt({
3291
3296
  }
3292
3297
  if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
3293
3298
  const output = part.output;
3299
+ 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") {
3300
+ anthropicContent.push({
3301
+ type: "tool_search_tool_result",
3302
+ tool_use_id: part.toolCallId,
3303
+ content: {
3304
+ type: "tool_search_tool_result_error",
3305
+ error_code: (_v = (await extractErrorValue(output.value)).errorCode) != null ? _v : "unavailable"
3306
+ },
3307
+ cache_control: cacheControl
3308
+ });
3309
+ break;
3310
+ }
3294
3311
  if (output.type !== "json") {
3295
3312
  warnings.push({
3296
3313
  type: "other",