From defee9ad13cbb43a53e6977b64673d0dba60e642 Mon Sep 17 00:00:00 2001 From: Sangsiva <101570025+Sangsiva@users.noreply.github.com> Date: Mon, 21 Sep 2026 15:50:44 +0800 Subject: [PATCH] fix(anthropic): suppress LIT002 for identity-strip payload lists The identity filter builds the filtered system list and its rewrite dict in a loop, same as the sibling billing-header filter; mark both mutable-ok. --- .../experimental_pass_through/messages/transformation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py index f754c558c87..13acc0bd437 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py @@ -150,7 +150,7 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): if isinstance(system_param, str): return strip_claude_code_identity(system_param) elif isinstance(system_param, list): - filtered_list: Final = [] + filtered_list: Final = [] # mutable-ok: API message payload for content_block in system_param: if isinstance(content_block, dict): text = content_block.get("text", "") @@ -165,7 +165,7 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): if stripped_text == text: filtered_list.append(content_block) else: - filtered_list.append({**content_block, "text": stripped_text}) + filtered_list.append({**content_block, "text": stripped_text}) # mutable-ok: API message payload else: # Keep non-dict items as-is filtered_list.append(content_block)