From d0bd9f5cd5d5938550e0f32d58d0abb69129f069 Mon Sep 17 00:00:00 2001 From: sailikhithk Date: Fri, 14 Aug 2026 22:31:30 -0500 Subject: [PATCH] chore: suppress LIT002 on messages fallback for Gemini token counter Adds `# mutable-ok:` suppression on the `messages or []` fallback passed to `_gemini_convert_messages_with_history`. The [] is a None-fallback; the helper signature requires list[AllMessageValues], so a tuple would violate the type contract. Resolves type-discipline-budget CI failure on PR #36981. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/llms/vertex_ai/common_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index d72fc88052d..d3e79ce3fdd 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -1170,7 +1170,11 @@ class VertexAITokenCounter(BaseTokenCounter): ) resolved_contents: Final = ( - contents if contents is not None else _gemini_convert_messages_with_history(messages=messages or []) + contents + if contents is not None + else _gemini_convert_messages_with_history( + messages=messages or [] # mutable-ok: fallback for None messages; helper signature requires list + ) ) count_tokens_params: Final = {