diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.json index 449ed5bfa1e..e03ed8abdca 100644 --- a/basedpyright-code-budget.json +++ b/basedpyright-code-budget.json @@ -57,7 +57,7 @@ "limit": 5601 }, "reportMissingTypeArgument": { - "limit": 15296 + "limit": 15292 }, "reportMissingTypeStubs": { "limit": 40 @@ -105,13 +105,13 @@ "limit": 109 }, "reportUnknownMemberType": { - "limit": 38341 + "limit": 38335 }, "reportUnknownParameterType": { "limit": 19625 }, "reportUnknownVariableType": { - "limit": 29873 + "limit": 29865 }, "reportUnnecessaryCast": { "limit": 111 diff --git a/litellm/llms/gigachat/chat/transformation.py b/litellm/llms/gigachat/chat/transformation.py index 991a93ccb21..89920ebd27b 100644 --- a/litellm/llms/gigachat/chat/transformation.py +++ b/litellm/llms/gigachat/chat/transformation.py @@ -10,6 +10,7 @@ import json import time import uuid from collections.abc import AsyncIterator, Iterator, Mapping, Sequence +from types import MappingProxyType from typing import TYPE_CHECKING, Any, Final import httpx @@ -34,6 +35,9 @@ else: LiteLLMLoggingObj = Any +_EMPTY_FUNCTION: Final[Mapping[str, object]] = MappingProxyType({}) + + def is_valid_json(value: str) -> bool: """Checks whether the value passed is a valid serialized JSON string""" try: @@ -213,7 +217,9 @@ class GigaChatConfig(BaseConfig): "parameters": function.get("parameters", {}), } for function in ( - tool.get("function", {}) for tool in tools if isinstance(tool, dict) and tool.get("type") == "function" + tool.get("function", _EMPTY_FUNCTION) + for tool in tools + if isinstance(tool, dict) and tool.get("type") == "function" ) ] diff --git a/type-discipline-budget.json b/type-discipline-budget.json index 5a4cae71d41..45d00a71d39 100644 --- a/type-discipline-budget.json +++ b/type-discipline-budget.json @@ -6,7 +6,7 @@ "limit": 26774 }, "LIT003": { - "limit": 264 + "limit": 262 }, "LIT004": { "limit": 40 @@ -27,10 +27,10 @@ "limit": 0 }, "LIT010": { - "limit": 16492 + "limit": 16488 }, "LIT011": { - "limit": 5527 + "limit": 5523 }, "LIT012": { "limit": 4495