mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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.
This commit is contained in:
parent
8ef6f755c9
commit
d873c194db
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue