@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/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.35" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.37" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -1838,7 +1838,7 @@ var AnthropicMessagesLanguageModel = class {
1838
1838
  });
1839
1839
  const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
1840
1840
  const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
1841
- const maxOutputTokensForModel = getMaxOutputTokensForModel(this.modelId);
1841
+ const { maxOutputTokens: maxOutputTokensForModel, knownModel } = getMaxOutputTokensForModel(this.modelId);
1842
1842
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
1843
1843
  const baseArgs = {
1844
1844
  // model id:
@@ -1900,7 +1900,7 @@ var AnthropicMessagesLanguageModel = class {
1900
1900
  }
1901
1901
  baseArgs.max_tokens = maxTokens + thinkingBudget;
1902
1902
  }
1903
- if (baseArgs.max_tokens > maxOutputTokensForModel) {
1903
+ if (knownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
1904
1904
  if (maxOutputTokens != null) {
1905
1905
  warnings.push({
1906
1906
  type: "unsupported-setting",
@@ -2726,13 +2726,15 @@ var AnthropicMessagesLanguageModel = class {
2726
2726
  };
2727
2727
  function getMaxOutputTokensForModel(modelId) {
2728
2728
  if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2729
- return 64e3;
2729
+ return { maxOutputTokens: 64e3, knownModel: true };
2730
2730
  } else if (modelId.includes("claude-opus-4-")) {
2731
- return 32e3;
2731
+ return { maxOutputTokens: 32e3, knownModel: true };
2732
2732
  } else if (modelId.includes("claude-3-5-haiku")) {
2733
- return 8192;
2733
+ return { maxOutputTokens: 8192, knownModel: true };
2734
+ } else if (modelId.includes("claude-3-haiku")) {
2735
+ return { maxOutputTokens: 4096, knownModel: true };
2734
2736
  } else {
2735
- return 4096;
2737
+ return { maxOutputTokens: 4096, knownModel: false };
2736
2738
  }
2737
2739
  }
2738
2740