Commit 94aed06
authored
fix(anthropic): allow both temperature and topP for non-Anthropic models (#14052)
## Background
The `@ai-sdk/anthropic` provider enforces temperature/topP mutual
exclusivity for all models (#11458), matching a constraint in the
Anthropic API. However, providers like Minimax use the
Anthropic-compatible API endpoint with non-Anthropic models (e.g.
`MiniMax-M2.7`) that require both `temperature` and `top_p` to be set
simultaneously. The SDK currently drops `topP` whenever both are
provided, with no way to override this behavior.
## Summary
- Renamed `isKnownModel` to `isKnownAnthropicModel` for clarity
- Updated the fallback in `getModelCapabilities` to return `true` for
unknown models whose ID starts with `claude-` (forward-compatible with
future Anthropic models)
- Added `isKnownAnthropicModel` as a guard for the temperature/topP
mutual exclusivity check — non-Anthropic models using the
Anthropic-compatible API can now send both parameters
## Manual Verification
Created a test using a non-Anthropic model ID (`MiniMax-M2.7`) that
verifies both `temperature` and `top_p` are sent in the request body
without warnings.1 parent 2122d7a commit 94aed06
File tree
3 files changed
+33
-2
lines changed- .changeset
- packages/anthropic/src
3 files changed
+33
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1168 | 1168 | | |
1169 | 1169 | | |
1170 | 1170 | | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1171 | 1191 | | |
1172 | 1192 | | |
1173 | 1193 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
275 | 277 | | |
276 | 278 | | |
277 | 279 | | |
| |||
535 | 537 | | |
536 | 538 | | |
537 | 539 | | |
538 | | - | |
539 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
| |||
0 commit comments