fix(ai): restore changelog and sdk type compatibility

This commit is contained in:
Mario Zechner
2026-04-16 20:32:23 +02:00
parent d131fcd4ba
commit a5f9f47d13
2 changed files with 17 additions and 3 deletions

View File

@@ -674,15 +674,21 @@ function buildParams(
params.tools = convertTools(context.tools, isOAuthToken, cacheControl);
}
// Configure thinking mode: adaptive (Opus 4.6 and Sonnet 4.6),
// Configure thinking mode: adaptive (Opus 4.6+ and Sonnet 4.6),
// budget-based (older models), or explicitly disabled.
if (model.reasoning) {
if (options?.thinkingEnabled) {
if (supportsAdaptiveThinking(model.id)) {
// Adaptive thinking: Claude decides when and how much to think
// Adaptive thinking: Claude decides when and how much to think.
// The Anthropic SDK types can lag newly supported effort values such as "xhigh".
params.thinking = { type: "adaptive" };
if (options.effort) {
params.output_config = { effort: options.effort };
params.output_config =
options.effort === "xhigh"
? ({ effort: options.effort } as unknown as NonNullable<
MessageCreateParamsStreaming["output_config"]
>)
: { effort: options.effort };
}
} else {
// Budget-based thinking for older models