From dd897e571dc1f83c44629237e8fd9f76d7be9fd9 Mon Sep 17 00:00:00 2001 From: Debanshu Das Date: Thu, 17 Sep 2026 22:40:02 +0000 Subject: [PATCH] fix: annotate anyOf list construction for the LIT002 budget --- litellm/llms/vertex_ai/common_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 5770832a10e..320d9acfdb3 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -854,7 +854,9 @@ def convert_anyof_null_to_nullable(schema, depth=0): anyof: Final = schema.get("anyOf", None) if anyof is not None: contains_null: Final = any(isinstance(atype, dict) and atype.get("type") == "null" for atype in anyof) - remaining: Final = [atype for atype in anyof if not (isinstance(atype, dict) and atype.get("type") == "null")] + remaining: Final = [ # mutable-ok: anyOf must stay a list for downstream schema consumers + atype for atype in anyof if not (isinstance(atype, dict) and atype.get("type") == "null") + ] if len(remaining) == 0: # Edge case: response schema with only null type present is invalid in Vertex AI