@ai-sdk/anthropic 3.0.0-beta.34 → 3.0.0-beta.36

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,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.0-beta.36
4
+
5
+ ### Patch Changes
6
+
7
+ - 21f378c: fix(provider/anthropic): do not limit maxTokens when model id is unknown
8
+
9
+ ## 3.0.0-beta.35
10
+
11
+ ### Patch Changes
12
+
13
+ - 80894b3: add return `file_id` property for anthropic code-execution-20250825 to download output files.
14
+
3
15
  ## 3.0.0-beta.34
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -157,6 +157,10 @@ declare const anthropicTools: {
157
157
  new_str: string;
158
158
  }, {
159
159
  type: "bash_code_execution_result";
160
+ content: Array<{
161
+ type: "bash_code_execution_output";
162
+ file_id: string;
163
+ }>;
160
164
  stdout: string;
161
165
  stderr: string;
162
166
  return_code: number;
@@ -203,6 +207,10 @@ declare const anthropicTools: {
203
207
  new_str: string;
204
208
  }, {
205
209
  type: "bash_code_execution_result";
210
+ content: Array<{
211
+ type: "bash_code_execution_output";
212
+ file_id: string;
213
+ }>;
206
214
  stdout: string;
207
215
  stderr: string;
208
216
  return_code: number;
package/dist/index.d.ts CHANGED
@@ -157,6 +157,10 @@ declare const anthropicTools: {
157
157
  new_str: string;
158
158
  }, {
159
159
  type: "bash_code_execution_result";
160
+ content: Array<{
161
+ type: "bash_code_execution_output";
162
+ file_id: string;
163
+ }>;
160
164
  stdout: string;
161
165
  stderr: string;
162
166
  return_code: number;
@@ -203,6 +207,10 @@ declare const anthropicTools: {
203
207
  new_str: string;
204
208
  }, {
205
209
  type: "bash_code_execution_result";
210
+ content: Array<{
211
+ type: "bash_code_execution_output";
212
+ file_id: string;
213
+ }>;
206
214
  stdout: string;
207
215
  stderr: string;
208
216
  return_code: number;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils20 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "3.0.0-beta.34" : "0.0.0-test";
34
+ var VERSION = true ? "3.0.0-beta.36" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -1919,7 +1919,7 @@ var AnthropicMessagesLanguageModel = class {
1919
1919
  });
1920
1920
  const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
1921
1921
  const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
1922
- const maxOutputTokensForModel = getMaxOutputTokensForModel(this.modelId);
1922
+ const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
1923
1923
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
1924
1924
  const baseArgs = {
1925
1925
  // model id:
@@ -1994,7 +1994,7 @@ var AnthropicMessagesLanguageModel = class {
1994
1994
  }
1995
1995
  baseArgs.max_tokens = maxTokens + thinkingBudget;
1996
1996
  }
1997
- if (baseArgs.max_tokens > maxOutputTokensForModel) {
1997
+ if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
1998
1998
  if (maxOutputTokens != null) {
1999
1999
  warnings.push({
2000
2000
  type: "unsupported-setting",
@@ -2884,13 +2884,15 @@ var AnthropicMessagesLanguageModel = class {
2884
2884
  };
2885
2885
  function getMaxOutputTokensForModel(modelId) {
2886
2886
  if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2887
- return 64e3;
2887
+ return { maxOutputTokens: 64e3, knownModel: true };
2888
2888
  } else if (modelId.includes("claude-opus-4-")) {
2889
- return 32e3;
2889
+ return { maxOutputTokens: 32e3, knownModel: true };
2890
2890
  } else if (modelId.includes("claude-3-5-haiku")) {
2891
- return 8192;
2891
+ return { maxOutputTokens: 8192, knownModel: true };
2892
+ } else if (modelId.includes("claude-3-haiku")) {
2893
+ return { maxOutputTokens: 4096, knownModel: true };
2892
2894
  } else {
2893
- return 4096;
2895
+ return { maxOutputTokens: 4096, knownModel: false };
2894
2896
  }
2895
2897
  }
2896
2898