From b85f1f2e6d1287d373da70dc20c5f7c32ec8dfcd Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Mon, 2 Feb 2026 19:00:12 +0530 Subject: [PATCH] fix: litellm_core_utils/prompt_templates/factory.py:3431 --- litellm/litellm_core_utils/prompt_templates/factory.py | 2 +- litellm/llms/anthropic/chat/guardrail_translation/handler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 09b7c5374d..c4c56a8d33 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -3427,7 +3427,7 @@ def _deduplicate_bedrock_content_blocks( deduplicated: List[BedrockContentBlock] = [] for block in blocks: keyed = block.get(block_key) - if keyed is not None: + if keyed is not None and isinstance(keyed, dict): block_id = keyed.get(id_key) if block_id: if block_id in seen_ids: diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 71d74121a3..8e1016bd5b 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -74,7 +74,7 @@ class AnthropicMessagesHandler(BaseTranslation): if messages is None: return data - chat_completion_compatible_request = ( + chat_completion_compatible_request, tool_name_mapping = ( LiteLLMAnthropicMessagesAdapter().translate_anthropic_to_openai( anthropic_message_request=cast(AnthropicMessagesRequest, data) )