@ai-sdk/anthropic 3.0.0-beta.97 → 3.0.0-beta.98

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.0-beta.98
4
+
5
+ ### Patch Changes
6
+
7
+ - 2049c5b: Fix handling of error in web fetch tool in anthropic
8
+
3
9
  ## 3.0.0-beta.97
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.0-beta.97" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.0-beta.98" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -2106,6 +2106,19 @@ async function convertToAnthropicMessagesPrompt({
2106
2106
  }
2107
2107
  if (providerToolName === "web_fetch") {
2108
2108
  const output = part.output;
2109
+ if (output.type === "error-json") {
2110
+ const errorValue = JSON.parse(output.value);
2111
+ anthropicContent.push({
2112
+ type: "web_fetch_tool_result",
2113
+ tool_use_id: part.toolCallId,
2114
+ content: {
2115
+ type: "web_fetch_tool_result_error",
2116
+ error_code: errorValue.errorCode
2117
+ },
2118
+ cache_control: cacheControl
2119
+ });
2120
+ break;
2121
+ }
2109
2122
  if (output.type !== "json") {
2110
2123
  warnings.push({
2111
2124
  type: "other",