From 69117370f2575655f3c3979bbbdc51303ee749e2 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Wed, 4 Nov 2026 17:51:24 +0700 Subject: [PATCH] fix(anthropic): leave a message that is not an object to litellm's validation under main's breakpoint strip --- litellm/integrations/anthropic_cache_control_hook.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/anthropic_cache_control_hook.py b/litellm/integrations/anthropic_cache_control_hook.py index ddfbc81389e..33b7ba86ca2 100644 --- a/litellm/integrations/anthropic_cache_control_hook.py +++ b/litellm/integrations/anthropic_cache_control_hook.py @@ -907,7 +907,10 @@ class AnthropicCacheControlHook(CustomPromptManagement): ) ) processed_messages = copy.deepcopy( - [without_prompt_cache_breakpoints(message) for message in messages] + [ + without_prompt_cache_breakpoints(message) if isinstance(message, dict) else message # pyright: ignore[reportUnnecessaryIsInstance] # a caller can send a non-object message + for message in messages + ] if not openai_dialect and message_points and _translates_prompt_cache_breakpoint(model, custom_llm_provider) else messages )