@ai-sdk/anthropic 3.0.5 → 3.0.6

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,19 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 2231e84: fix(anthropic): implement temperature/topP mutual exclusivity
8
+
9
+ Resolves the Anthropic API breaking change where sampling parameters must use only `temperature` OR `top_p`, not both. When both parameters are provided:
10
+
11
+ - Temperature takes priority and topP is ignored
12
+ - A warning is added to inform users: "topP is not supported when temperature is set. topP is ignored."
13
+ - The validation only runs when thinking mode is not enabled (thinking mode has its own parameter validation)
14
+
15
+ See Anthropic migration guide: https://platform.claude.com/docs/en/about-claude/models/migrating-to-claude-4
16
+
3
17
  ## 3.0.5
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.5" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.6" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -2584,6 +2584,15 @@ var AnthropicMessagesLanguageModel = class {
2584
2584
  });
2585
2585
  }
2586
2586
  baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
2587
+ } else {
2588
+ if (topP != null && temperature != null) {
2589
+ warnings.push({
2590
+ type: "unsupported",
2591
+ feature: "topP",
2592
+ details: `topP is not supported when temperature is set. topP is ignored.`
2593
+ });
2594
+ baseArgs.top_p = void 0;
2595
+ }
2587
2596
  }
2588
2597
  if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2589
2598
  if (maxOutputTokens != null) {