@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.
@@ -562,7 +562,11 @@ var anthropicProviderOptions = z3.object({
562
562
  version: z3.string().optional()
563
563
  })
564
564
  ).optional()
565
- }).optional()
565
+ }).optional(),
566
+ /**
567
+ * @default 'high'
568
+ */
569
+ effort: z3.enum(["low", "medium", "high"]).optional()
566
570
  });
567
571
 
568
572
  // src/anthropic-prepare-tools.ts
@@ -1788,6 +1792,21 @@ var AnthropicMessagesLanguageModel = class {
1788
1792
  setting: "seed"
1789
1793
  });
1790
1794
  }
1795
+ if (temperature != null && temperature > 1) {
1796
+ warnings.push({
1797
+ type: "unsupported-setting",
1798
+ setting: "temperature",
1799
+ details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
1800
+ });
1801
+ temperature = 1;
1802
+ } else if (temperature != null && temperature < 0) {
1803
+ warnings.push({
1804
+ type: "unsupported-setting",
1805
+ setting: "temperature",
1806
+ details: `${temperature} is below anthropic minimum of 0. clamped to 0`
1807
+ });
1808
+ temperature = 0;
1809
+ }
1791
1810
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
1792
1811
  if (responseFormat.schema == null) {
1793
1812
  warnings.push({
@@ -1838,6 +1857,9 @@ var AnthropicMessagesLanguageModel = class {
1838
1857
  ...isThinking && {
1839
1858
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1840
1859
  },
1860
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
1861
+ output_config: { effort: anthropicOptions.effort }
1862
+ },
1841
1863
  // container with agent skills:
1842
1864
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1843
1865
  container: {
@@ -1908,6 +1930,9 @@ var AnthropicMessagesLanguageModel = class {
1908
1930
  });
1909
1931
  }
1910
1932
  }
1933
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
1934
+ betas.add("effort-2025-11-24");
1935
+ }
1911
1936
  const {
1912
1937
  tools: anthropicTools2,
1913
1938
  toolChoice: anthropicToolChoice,
@@ -2711,7 +2736,17 @@ var AnthropicMessagesLanguageModel = class {
2711
2736
  }
2712
2737
  };
2713
2738
  function getMaxOutputTokensForModel(modelId) {
2714
- if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2739
+ if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5")) {
2740
+ return {
2741
+ maxOutputTokens: 64e3,
2742
+ knownModel: true
2743
+ };
2744
+ } else if (modelId.includes("claude-opus-4-1")) {
2745
+ return {
2746
+ maxOutputTokens: 32e3,
2747
+ knownModel: true
2748
+ };
2749
+ } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2715
2750
  return { maxOutputTokens: 64e3, knownModel: true };
2716
2751
  } else if (modelId.includes("claude-opus-4-")) {
2717
2752
  return { maxOutputTokens: 32e3, knownModel: true };