@ai-sdk/anthropic 2.0.35 → 2.0.37

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
+ ## 2.0.37
4
+
5
+ ### Patch Changes
6
+
7
+ - de1d309: fix(provider/anthropic): do not limit maxTokens when model id is unknown
8
+
9
+ ## 2.0.36
10
+
11
+ ### Patch Changes
12
+
13
+ - 5a46f11: add return `file_id` property for anthropic code-execution-20250825 to download output files.
14
+
3
15
  ## 2.0.35
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -147,6 +147,10 @@ declare const anthropicTools: {
147
147
  new_str: string;
148
148
  }, {
149
149
  type: "bash_code_execution_result";
150
+ content: Array<{
151
+ type: "bash_code_execution_output";
152
+ file_id: string;
153
+ }>;
150
154
  stdout: string;
151
155
  stderr: string;
152
156
  return_code: number;
@@ -193,6 +197,10 @@ declare const anthropicTools: {
193
197
  new_str: string;
194
198
  }, {
195
199
  type: "bash_code_execution_result";
200
+ content: Array<{
201
+ type: "bash_code_execution_output";
202
+ file_id: string;
203
+ }>;
196
204
  stdout: string;
197
205
  stderr: string;
198
206
  return_code: number;
package/dist/index.d.ts CHANGED
@@ -147,6 +147,10 @@ declare const anthropicTools: {
147
147
  new_str: string;
148
148
  }, {
149
149
  type: "bash_code_execution_result";
150
+ content: Array<{
151
+ type: "bash_code_execution_output";
152
+ file_id: string;
153
+ }>;
150
154
  stdout: string;
151
155
  stderr: string;
152
156
  return_code: number;
@@ -193,6 +197,10 @@ declare const anthropicTools: {
193
197
  new_str: string;
194
198
  }, {
195
199
  type: "bash_code_execution_result";
200
+ content: Array<{
201
+ type: "bash_code_execution_output";
202
+ file_id: string;
203
+ }>;
196
204
  stdout: string;
197
205
  stderr: string;
198
206
  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 ? "2.0.35" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.37" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -1820,7 +1820,7 @@ var AnthropicMessagesLanguageModel = class {
1820
1820
  });
1821
1821
  const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
1822
1822
  const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
1823
- const maxOutputTokensForModel = getMaxOutputTokensForModel(this.modelId);
1823
+ const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
1824
1824
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
1825
1825
  const baseArgs = {
1826
1826
  // model id:
@@ -1882,7 +1882,7 @@ var AnthropicMessagesLanguageModel = class {
1882
1882
  }
1883
1883
  baseArgs.max_tokens = maxTokens + thinkingBudget;
1884
1884
  }
1885
- if (baseArgs.max_tokens > maxOutputTokensForModel) {
1885
+ if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
1886
1886
  if (maxOutputTokens != null) {
1887
1887
  warnings.push({
1888
1888
  type: "unsupported-setting",
@@ -2708,13 +2708,15 @@ var AnthropicMessagesLanguageModel = class {
2708
2708
  };
2709
2709
  function getMaxOutputTokensForModel(modelId) {
2710
2710
  if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2711
- return 64e3;
2711
+ return { maxOutputTokens: 64e3, knownModel: true };
2712
2712
  } else if (modelId.includes("claude-opus-4-")) {
2713
- return 32e3;
2713
+ return { maxOutputTokens: 32e3, knownModel: true };
2714
2714
  } else if (modelId.includes("claude-3-5-haiku")) {
2715
- return 8192;
2715
+ return { maxOutputTokens: 8192, knownModel: true };
2716
+ } else if (modelId.includes("claude-3-haiku")) {
2717
+ return { maxOutputTokens: 4096, knownModel: true };
2716
2718
  } else {
2717
- return 4096;
2719
+ return { maxOutputTokens: 4096, knownModel: false };
2718
2720
  }
2719
2721
  }
2720
2722