From 6132d8d369dee67b332600c89323789daf987fe2 Mon Sep 17 00:00:00 2001 From: adhavan18 Date: Thu, 24 Sep 2026 14:14:38 +0530 Subject: [PATCH] fix(adapter): preserve empty thinking field shape --- .../experimental_pass_through/adapters/transformation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index d3e24cdd11d..df57d8b8521 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -635,6 +635,9 @@ class LiteLLMAnthropicMessagesAdapter: ) ): assistant_message["thinking_blocks"] = thinking_blocks + elif len(thinking_blocks) == 0: + # Preserve the existing response shape for ordinary assistant turns. + assistant_message["thinking_blocks"] = None reasoning_content = reasoning_content_from_thinking_blocks(thinking_blocks) if reasoning_content: assistant_message["reasoning_content"] = reasoning_content