@fairyhunter13/ai-anthropic 3.0.58-fork.21 → 3.0.58-fork.22

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.
@@ -2791,6 +2791,18 @@ async function convertToAnthropicMessagesPrompt({
2791
2791
  }
2792
2792
  if (providerToolName === "web_search") {
2793
2793
  const output = part.output;
2794
+ if (output.type === "error-text" || output.type === "error-json") {
2795
+ anthropicContent.push({
2796
+ type: "web_search_tool_result",
2797
+ tool_use_id: part.toolCallId,
2798
+ content: {
2799
+ type: "web_search_tool_result_error",
2800
+ error_code: "unavailable"
2801
+ },
2802
+ cache_control: cacheControl
2803
+ });
2804
+ break;
2805
+ }
2794
2806
  if (output.type !== "json") {
2795
2807
  warnings.push({
2796
2808
  type: "other",