@ai-sdk/anthropic 4.0.7 → 4.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.7",
3
+ "version": "4.0.8",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -422,6 +422,10 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
422
422
  const thinkingType = anthropicOptions?.thinking?.type;
423
423
  const isThinking =
424
424
  thinkingType === 'enabled' || thinkingType === 'adaptive';
425
+ // `disabled` must still be forwarded to the API: some models (e.g. Sonnet 5)
426
+ // default thinking on, so omitting it would leave thinking enabled and
427
+ // consume the max_tokens budget.
428
+ const sendThinking = isThinking || thinkingType === 'disabled';
425
429
  let thinkingBudget =
426
430
  thinkingType === 'enabled'
427
431
  ? anthropicOptions?.thinking?.budgetTokens
@@ -445,7 +449,7 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
445
449
  stop_sequences: stopSequences,
446
450
 
447
451
  // provider specific settings:
448
- ...(isThinking && {
452
+ ...(sendThinking && {
449
453
  thinking: {
450
454
  type: thinkingType,
451
455
  ...(thinkingBudget != null && { budget_tokens: thinkingBudget }),