From d873c194db24b86c8ddf225e04e33f3ae0477dee Mon Sep 17 00:00:00 2001 From: Mohammad Ali Farhan Date: Sat, 8 Aug 2026 13:49:40 +0530 Subject: [PATCH] fix(vertex_ai): freeze the merged tool mapping to satisfy LIT002 The dict literal introduced by the previous commit is mutable-collection construction, which put LIT002 one over its ceiling in the type-discipline gate. Wrapping it in MappingProxyType keeps the one-shot construction Greptile asked for while staying inside the budget: a literal passed straight to a freezing wrapper is exempt, and ** unpacking accepts any mapping. --- .../vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index ded975ac795..731a30bc25c 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -6,6 +6,7 @@ import time from collections.abc import Callable, Mapping from copy import deepcopy from functools import partial +from types import MappingProxyType from typing import TYPE_CHECKING, Any, Final, Literal, Optional, Union, cast import httpx @@ -606,7 +607,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): elif "name" in tool: # functions list _input_schema = tool.get("input_schema") if tool.get("parameters") is None else None _named_tool = ( - {**tool, "parameters": _build_vertex_schema(_input_schema)} + MappingProxyType({**tool, "parameters": _build_vertex_schema(_input_schema)}) if isinstance(_input_schema, dict) else tool )