From a5f9f47d135d0b234a841500c5af9db224169017 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 16 Apr 2026 20:32:23 +0200 Subject: [PATCH] fix(ai): restore changelog and sdk type compatibility --- packages/ai/CHANGELOG.md | 8 ++++++++ packages/ai/src/providers/anthropic.ts | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 39cbfe11..86b9ebaa 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -6,6 +6,14 @@ - Added `onResponse` to `StreamOptions` so callers can inspect provider HTTP status and headers after each response arrives and before the response stream is consumed ([#3128](https://github.com/badlogic/pi-mono/issues/3128)) +## [0.67.5] - 2026-04-16 + +### Fixed + +- Fixed Opus 4.7 adaptive thinking configuration across Anthropic and Bedrock providers by recognizing Opus 4.7 adaptive-thinking support and mapping `xhigh` reasoning to provider-supported effort values ([#3286](https://github.com/badlogic/pi-mono/pull/3286) by [@markusylisiurunen](https://github.com/markusylisiurunen)) + +## [0.67.4] - 2026-04-16 + ### Changed - Added `claude-opus-4-7` model for Anthropic, OpenRouter. diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts index 1d6ee9bc..861bab8a 100644 --- a/packages/ai/src/providers/anthropic.ts +++ b/packages/ai/src/providers/anthropic.ts @@ -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