@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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.47
4
+
5
+ ### Patch Changes
6
+
7
+ - 3a7a427: 'fix(anthropic): Opus 4.5 `maxOutputTokens` bump `32000` -> `64000`'
8
+
9
+ ## 2.0.46
10
+
11
+ ### Patch Changes
12
+
13
+ - 54a0480: Opus 4.5 and `effort` provider option
14
+
15
+ ## 2.0.45
16
+
17
+ ### Patch Changes
18
+
19
+ - 54b7c08: fix(provider/anthropic): clamp temperature to valid 0-1 range with warnings
20
+
3
21
  ## 2.0.44
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -42,7 +42,7 @@ interface AnthropicMessageMetadata {
42
42
  } | null;
43
43
  }
44
44
 
45
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
45
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
46
46
  declare const anthropicProviderOptions: z.ZodObject<{
47
47
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
48
48
  thinking: z.ZodOptional<z.ZodObject<{
@@ -62,6 +62,11 @@ declare const anthropicProviderOptions: z.ZodObject<{
62
62
  version: z.ZodOptional<z.ZodString>;
63
63
  }, z.core.$strip>>>;
64
64
  }, z.core.$strip>>;
65
+ effort: z.ZodOptional<z.ZodEnum<{
66
+ low: "low";
67
+ medium: "medium";
68
+ high: "high";
69
+ }>>;
65
70
  }, z.core.$strip>;
66
71
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
67
72
 
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ interface AnthropicMessageMetadata {
42
42
  } | null;
43
43
  }
44
44
 
45
- type AnthropicMessagesModelId = 'claude-haiku-4-5' | 'claude-haiku-4-5-20251001' | 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
45
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | (string & {});
46
46
  declare const anthropicProviderOptions: z.ZodObject<{
47
47
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
48
48
  thinking: z.ZodOptional<z.ZodObject<{
@@ -62,6 +62,11 @@ declare const anthropicProviderOptions: z.ZodObject<{
62
62
  version: z.ZodOptional<z.ZodString>;
63
63
  }, z.core.$strip>>>;
64
64
  }, z.core.$strip>>;
65
+ effort: z.ZodOptional<z.ZodEnum<{
66
+ low: "low";
67
+ medium: "medium";
68
+ high: "high";
69
+ }>>;
65
70
  }, z.core.$strip>;
66
71
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
67
72
 
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.44" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.47" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -583,7 +583,11 @@ var anthropicProviderOptions = import_v43.z.object({
583
583
  version: import_v43.z.string().optional()
584
584
  })
585
585
  ).optional()
586
- }).optional()
586
+ }).optional(),
587
+ /**
588
+ * @default 'high'
589
+ */
590
+ effort: import_v43.z.enum(["low", "medium", "high"]).optional()
587
591
  });
588
592
 
589
593
  // src/anthropic-prepare-tools.ts
@@ -1785,6 +1789,21 @@ var AnthropicMessagesLanguageModel = class {
1785
1789
  setting: "seed"
1786
1790
  });
1787
1791
  }
1792
+ if (temperature != null && temperature > 1) {
1793
+ warnings.push({
1794
+ type: "unsupported-setting",
1795
+ setting: "temperature",
1796
+ details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
1797
+ });
1798
+ temperature = 1;
1799
+ } else if (temperature != null && temperature < 0) {
1800
+ warnings.push({
1801
+ type: "unsupported-setting",
1802
+ setting: "temperature",
1803
+ details: `${temperature} is below anthropic minimum of 0. clamped to 0`
1804
+ });
1805
+ temperature = 0;
1806
+ }
1788
1807
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
1789
1808
  if (responseFormat.schema == null) {
1790
1809
  warnings.push({
@@ -1835,6 +1854,9 @@ var AnthropicMessagesLanguageModel = class {
1835
1854
  ...isThinking && {
1836
1855
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1837
1856
  },
1857
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
1858
+ output_config: { effort: anthropicOptions.effort }
1859
+ },
1838
1860
  // container with agent skills:
1839
1861
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1840
1862
  container: {
@@ -1905,6 +1927,9 @@ var AnthropicMessagesLanguageModel = class {
1905
1927
  });
1906
1928
  }
1907
1929
  }
1930
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
1931
+ betas.add("effort-2025-11-24");
1932
+ }
1908
1933
  const {
1909
1934
  tools: anthropicTools2,
1910
1935
  toolChoice: anthropicToolChoice,
@@ -2708,7 +2733,17 @@ var AnthropicMessagesLanguageModel = class {
2708
2733
  }
2709
2734
  };
2710
2735
  function getMaxOutputTokensForModel(modelId) {
2711
- if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2736
+ if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5")) {
2737
+ return {
2738
+ maxOutputTokens: 64e3,
2739
+ knownModel: true
2740
+ };
2741
+ } else if (modelId.includes("claude-opus-4-1")) {
2742
+ return {
2743
+ maxOutputTokens: 32e3,
2744
+ knownModel: true
2745
+ };
2746
+ } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet") || modelId.includes("claude-haiku-4-5")) {
2712
2747
  return { maxOutputTokens: 64e3, knownModel: true };
2713
2748
  } else if (modelId.includes("claude-opus-4-")) {
2714
2749
  return { maxOutputTokens: 32e3, knownModel: true };