The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
chore(typing): drop fresh tech debt suppressions
Devin AIf44e7ad9fb6d
diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.jsonindex 9dcc46ebcee..3f0011c80d2 100644--- a/basedpyright-code-budget.json+++ b/basedpyright-code-budget.json@@ -1,6 +1,6 @@{"reportAny": {- "limit": 19954+ "limit": 19945},"reportArgumentType": {"limit": 2566@@ -24,7 +24,7 @@"limit": 19},"reportExplicitAny": {- "limit": 6049+ "limit": 6048},"reportFunctionMemberAccess": {"limit": 7@@ -57,7 +57,7 @@"limit": 5663},"reportMissingTypeArgument": {- "limit": 15553+ "limit": 15545},"reportMissingTypeStubs": {"limit": 40@@ -105,13 +105,13 @@"limit": 109},"reportUnknownMemberType": {- "limit": 39007+ "limit": 38998},"reportUnknownParameterType": {- "limit": 19883+ "limit": 19876},"reportUnknownVariableType": {- "limit": 30568+ "limit": 30554},"reportUnnecessaryCast": {"limit": 117diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.pyindex ed079197513..cdd81b24ca3 100644--- a/litellm/llms/custom_httpx/llm_http_handler.py+++ b/litellm/llms/custom_httpx/llm_http_handler.py@@ -5594,10 +5594,9 @@ class BaseLLMHTTPHandler:kwargs=hook_kwargs,)except Exception as e:- _call_id = getattr(logging_obj, "litellm_call_id", "unknown")verbose_logger.exception("LiteLLM.AgenticHookError: Exception in async_should_run_agentic_loop [call_id=%s model=%s]: %s",- _call_id,+ logging_obj.litellm_call_id,model,str(e),)@@ -5619,10 +5618,9 @@ class BaseLLMHTTPHandler:except AgenticLoopSafetyError as e:if not self._can_replace_turn_with_terminal_response(stream, api_surface):raise- _call_id = getattr(logging_obj, "litellm_call_id", "unknown")verbose_logger.warning("LiteLLM.AgenticLoopRefused: ending turn [call_id=%s model=%s]: %s",- _call_id,+ logging_obj.litellm_call_id,model,str(e),)diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.pyindex cb5002e431b..064b53e07b7 100644--- a/litellm/proxy/litellm_pre_call_utils.py+++ b/litellm/proxy/litellm_pre_call_utils.py@@ -4,7 +4,7 @@ import jsonimport reimport timefrom collections import OrderedDict-from collections.abc import Mapping+from collections.abc import Mapping, MutableMappingfrom types import MappingProxyTypefrom typing import TYPE_CHECKING, Any, Final@@ -1629,7 +1629,7 @@ class LiteLLMProxyRequestSetup:def refresh_proxy_server_request_body_snapshot(- data: dict, # mutable-ok: mutates proxy_server_request.body in place on the shared request dict+ data: MutableMapping[str, object],) -> None:"""Re-snapshot ``data["proxy_server_request"]["body"]`` from the current state of ``data``.diff --git a/litellm/proxy/openai_files_endpoints/common_utils.py b/litellm/proxy/openai_files_endpoints/common_utils.pyindex 142aced4a38..134ed74ae65 100644--- a/litellm/proxy/openai_files_endpoints/common_utils.py+++ b/litellm/proxy/openai_files_endpoints/common_utils.py@@ -1346,11 +1346,12 @@ def _completed_batch_safe_to_retire(response: "LiteLLMBatch") -> bool:reports no successful request lines. When counts are unknown, stay eligible sothe next poller pass revisits it. (#37713)"""- if getattr(response, "output_file_id", None) is not None:+ if response.output_file_id is not None:return True- request_counts = getattr(response, "request_counts", None)- completed = getattr(request_counts, "completed", None)- return completed == 0+ request_counts = response.request_counts+ if request_counts is None:+ return False+ return request_counts.completed == 0async def update_batch_in_database(diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 7dced4e26b6..e14a64a9ff8 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -4084,7 +4084,7 @@ def resolve_complexity_router_plugins(complexity_router_config["classifier_plugin"] = resolved_classifier # rebind-ok: out-param, resolved in place-def validate_deployment_max_agentic_loops(model: Mapping[str, Any]) -> None:+def validate_deployment_max_agentic_loops(model: Mapping[str, object]) -> None:"""Reject a per-deployment `max_agentic_loops` the agentic loop cannot honor.@@ -4094,7 +4094,9 @@ def validate_deployment_max_agentic_loops(model: Mapping[str, Any]) -> None:start. Left unchecked entirely, a `0` used to read as the default ceilingof 3 and a non-integer failed every request to that model instead."""- litellm_params: Final = model.get("litellm_params") or {}+ litellm_params: Final = model.get("litellm_params")+ if not isinstance(litellm_params, Mapping):+ returnif "max_agentic_loops" not in litellm_params:returndiff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.pyindex b8d7b726a28..db12361f70f 100644--- a/litellm/responses/litellm_completion_transformation/transformation.py+++ b/litellm/responses/litellm_completion_transformation/transformation.py@@ -1272,16 +1272,14 @@ class LiteLLMCompletionResponsesConfig:if isinstance(content, str) and content.strip():return contentif isinstance(content, list):- text_parts: Final[list[str]] = [] # mutable-ok: text accumulator- for block in content:- if not isinstance(block, Mapping):- continue- block_type = block.get("type")- if block_type in ("encrypted_content", "redacted_thinking"):- continue- text = block.get("text")- if isinstance(text, str) and text.strip():- text_parts.append(text.strip())+ text_parts: Final = tuple(+ text.strip()+ for block in content+ if isinstance(block, Mapping)+ and block.get("type") not in ("encrypted_content", "redacted_thinking")+ and isinstance(text := block.get("text"), str)+ and text.strip()+ )if text_parts:return "\n".join(text_parts)return None@@ -1297,13 +1295,13 @@ class LiteLLMCompletionResponsesConfig:summary: Final[object] = input_item.get("summary")if not isinstance(summary, list):return None- text_parts: Final[list[str]] = [] # mutable-ok: text accumulator- for block in summary:- if not isinstance(block, Mapping):- continue- text = block.get("text")- if isinstance(text, str) and text.strip():- text_parts.append(text.strip())+ text_parts: Final = tuple(+ text.strip()+ for block in summary+ if isinstance(block, Mapping)+ and isinstance(text := block.get("text"), str)+ and text.strip()+ )return "\n".join(text_parts) if text_parts else None@staticmethoddiff --git a/ruff-strict-budget.json b/ruff-strict-budget.jsonindex 3e037e5bedc..3585c7a7bd3 100644--- a/ruff-strict-budget.json+++ b/ruff-strict-budget.json@@ -12,10 +12,10 @@"limit": 2016},"ANN202": {- "limit": 851+ "limit": 850},"ANN204": {- "limit": 710+ "limit": 709},"ANN205": {"limit": 112@@ -24,7 +24,7 @@"limit": 133},"ANN401": {- "limit": 1187+ "limit": 1185},"ASYNC230": {"limit": 11@@ -234,7 +234,7 @@"limit": 5},"TID251": {- "limit": 1211+ "limit": 1210},"TRY002": {"limit": 524diff --git a/type-discipline-budget.json b/type-discipline-budget.jsonindex 81f7c6aa40b..4f2314b2a0a 100644--- a/type-discipline-budget.json+++ b/type-discipline-budget.json@@ -1,9 +1,9 @@{"LIT001": {- "limit": 22801+ "limit": 22795},"LIT002": {- "limit": 26873+ "limit": 26872},"LIT003": {"limit": 269@@ -27,7 +27,7 @@"limit": 0},"LIT010": {- "limit": 16673+ "limit": 16672},"LIT011": {"limit": 5588