@ai-sdk/anthropic 2.0.44 → 2.0.47

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.44" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.47" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -577,7 +577,11 @@ var anthropicProviderOptions = z3.object({
577
577
  version: z3.string().optional()
578
578
  })
579
579
  ).optional()
580
- }).optional()
580
+ }).optional(),
581
+ /**
582
+ * @default 'high'
583
+ */
584
+ effort: z3.enum(["low", "medium", "high"]).optional()
581
585
  });
582
586
 
583
587
  // src/anthropic-prepare-tools.ts
@@ -1803,6 +1807,21 @@ var AnthropicMessagesLanguageModel = class {
1803
1807
  setting: "seed"
1804
1808
  });
1805
1809
  }
1810
+ if (temperature != null && temperature > 1) {
1811
+ warnings.push({
1812
+ type: "unsupported-setting",
1813
+ setting: "temperature",
1814
+ details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
1815
+ });
1816
+ temperature = 1;
1817
+ } else if (temperature != null && temperature < 0) {
1818
+ warnings.push({
1819
+ type: "unsupported-setting",
1820
+ setting: "temperature",
1821
+ details: `${temperature} is below anthropic minimum of 0. clamped to 0`
1822
+ });
1823
+ temperature = 0;
1824
+ }
1806
1825
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
1807
1826
  if (responseFormat.schema == null) {
1808
1827
  warnings.push({
@@ -1853,6 +1872,9 @@ var AnthropicMessagesLanguageModel = class {
1853
1872
  ...isThinking && {
1854
1873
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1855
1874
  },
1875
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
1876
+ output_config: { effort: anthropicOptions.effort }
1877
+ },
1856
1878
  // container with agent skills:
1857
1879
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1858
1880
  container: {
@@ -1923,6 +1945,9 @@ var AnthropicMessagesLanguageModel = class {
1923
1945
  });
1924
1946
  }
1925
1947
  }
1948
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
1949
+ betas.add("effort-2025-11-24");
1950
+ }
1926
1951
  const {
1927
1952
  tools: anthropicTools2,
1928
1953
  toolChoice: anthropicToolChoice,
@@ -2726,7 +2751,17 @@ var AnthropicMessagesLanguageModel = class {
2726
2751
  }
2727
2752
  };
2728
2753
  function getMaxOutputTokensForModel(modelId) {
2729
- if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2754
+ if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5")) {
2755
+ return {
2756
+ maxOutputTokens: 64e3,
2757
+ knownModel: true
2758
+ };
2759
+ } else if (modelId.includes("claude-opus-4-1")) {
2760
+ return {
2761
+ maxOutputTokens: 32e3,
2762
+ knownModel: true
2763
+ };
2764
+ } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2730
2765
  return { maxOutputTokens: 64e3, knownModel: true };
2731
2766
  } else if (modelId.includes("claude-opus-4-")) {
2732
2767
  return { maxOutputTokens: 32e3, knownModel: true };