fix(ai): preserve qwen chat-template thinking closes #3325

This commit is contained in:
Mario Zechner
2026-04-17 16:59:00 +02:00
parent 0bb4ccf11f
commit e3f6912d49
2 changed files with 5 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
### Fixed
- Fixed Anthropic and Bedrock adaptive-thinking payload tests to expect the default `display: "summarized"` field when reasoning is enabled.
- Fixed `qwen-chat-template` OpenAI-compatible requests to set `chat_template_kwargs.preserve_thinking: true`, preserving prior Qwen thinking across turns so multi-turn tool calls keep their arguments instead of degrading to empty `{}` payloads ([#3325](https://github.com/badlogic/pi-mono/issues/3325))
## [0.67.6] - 2026-04-16

View File

@@ -422,7 +422,10 @@ function buildParams(model: Model<"openai-completions">, context: Context, optio
} else if (compat.thinkingFormat === "qwen" && model.reasoning) {
(params as any).enable_thinking = !!options?.reasoningEffort;
} else if (compat.thinkingFormat === "qwen-chat-template" && model.reasoning) {
(params as any).chat_template_kwargs = { enable_thinking: !!options?.reasoningEffort };
(params as any).chat_template_kwargs = {
enable_thinking: !!options?.reasoningEffort,
preserve_thinking: true,
};
} else if (compat.thinkingFormat === "openrouter" && model.reasoning) {
// OpenRouter normalizes reasoning across providers via a nested reasoning object.
const openRouterParams = params as typeof params & { reasoning?: { effort?: string } };