From 0367e9c9f11b7f8f68166a7d1bb68c56523a8776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20=C3=93skarsson?= Date: Mon, 19 Jan 2026 14:50:57 +0000 Subject: [PATCH] fix: pr ammends. --- litellm/llms/bedrock/chat/converse_transformation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index fd8c0d75473..cb26a22edfa 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -55,6 +55,7 @@ from litellm.types.utils import ( ) from litellm.utils import ( add_dummy_tool, + any_assistant_message_has_thinking_blocks, has_tool_call_blocks, last_assistant_with_tool_calls_has_no_thinking_blocks, supports_reasoning, @@ -1077,11 +1078,15 @@ class AmazonConverseConfig(BaseConfig): # Drop thinking param if thinking is enabled but thinking_blocks are missing # This prevents the error: "Expected thinking or redacted_thinking, but found tool_use" + # + # IMPORTANT: Only drop thinking if NO assistant messages have thinking_blocks. + # If any message has thinking_blocks, we must keep thinking enabled, otherwise # Related issues: https://github.com/BerriAI/litellm/issues/14194 if ( optional_params.get("thinking") is not None and messages is not None and last_assistant_with_tool_calls_has_no_thinking_blocks(messages) + and not any_assistant_message_has_thinking_blocks(messages) ): if litellm.modify_params: optional_params.pop("thinking", None)