@fairyhunter13/ai-anthropic 3.0.58-fork.20 → 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.
package/dist/index.js CHANGED
@@ -2798,6 +2798,18 @@ async function convertToAnthropicMessagesPrompt({
2798
2798
  }
2799
2799
  if (providerToolName === "web_search") {
2800
2800
  const output = part.output;
2801
+ if (output.type === "error-text" || output.type === "error-json") {
2802
+ anthropicContent.push({
2803
+ type: "web_search_tool_result",
2804
+ tool_use_id: part.toolCallId,
2805
+ content: {
2806
+ type: "web_search_tool_result_error",
2807
+ error_code: "unavailable"
2808
+ },
2809
+ cache_control: cacheControl
2810
+ });
2811
+ break;
2812
+ }
2801
2813
  if (output.type !== "json") {
2802
2814
  warnings.push({
2803
2815
  type: "other",