From 3fe48296768896883ddc20438ff09266a968f310 Mon Sep 17 00:00:00 2001 From: Chesars Date: Tue, 10 Mar 2026 16:37:06 -0300 Subject: [PATCH] fix: include redacted_thinking in list-content thinking block detection The _list_has_thinking guard only checked for type == "thinking" but Anthropic can also return redacted_thinking blocks (safety-filtered). These are also accumulated in thinking_blocks, so the same duplication bug would occur with redacted thinking content. --- litellm/litellm_core_utils/prompt_templates/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 84e4aeb1a2f..1bcf53e3778 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -2626,7 +2626,7 @@ def anthropic_messages_pt( # noqa: PLR0915 _list_has_thinking = False if _content_is_list: for _item in assistant_content_block["content"]: - if isinstance(_item, dict) and _item.get("type") == "thinking": + if isinstance(_item, dict) and _item.get("type") in ("thinking", "redacted_thinking"): _list_has_thinking = True break