@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/CHANGELOG.md +8 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +2 -1
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-language-model.ts +5 -1
package/package.json
CHANGED
|
@@ -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
|
-
...(
|
|
452
|
+
...(sendThinking && {
|
|
449
453
|
thinking: {
|
|
450
454
|
type: thinkingType,
|
|
451
455
|
...(thinkingBudget != null && { budget_tokens: thinkingBudget }),
|