@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.
@@ -2823,6 +2823,18 @@ async function convertToAnthropicMessagesPrompt({
2823
2823
  }
2824
2824
  if (providerToolName === "web_search") {
2825
2825
  const output = part.output;
2826
+ if (output.type === "error-text" || output.type === "error-json") {
2827
+ anthropicContent.push({
2828
+ type: "web_search_tool_result",
2829
+ tool_use_id: part.toolCallId,
2830
+ content: {
2831
+ type: "web_search_tool_result_error",
2832
+ error_code: "unavailable"
2833
+ },
2834
+ cache_control: cacheControl
2835
+ });
2836
+ break;
2837
+ }
2826
2838
  if (output.type !== "json") {
2827
2839
  warnings.push({
2828
2840
  type: "other",