@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.
package/dist/index.mjs CHANGED
@@ -2839,6 +2839,18 @@ async function convertToAnthropicMessagesPrompt({
2839
2839
  }
2840
2840
  if (providerToolName === "web_search") {
2841
2841
  const output = part.output;
2842
+ if (output.type === "error-text" || output.type === "error-json") {
2843
+ anthropicContent.push({
2844
+ type: "web_search_tool_result",
2845
+ tool_use_id: part.toolCallId,
2846
+ content: {
2847
+ type: "web_search_tool_result_error",
2848
+ error_code: "unavailable"
2849
+ },
2850
+ cache_control: cacheControl
2851
+ });
2852
+ break;
2853
+ }
2842
2854
  if (output.type !== "json") {
2843
2855
  warnings.push({
2844
2856
  type: "other",