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(lint): remove PLR0915 too-many-statements ruff rule (#30574)
ryan-crabbe-berri5a62806fdc09
diff --git a/db_scripts/create_views.py b/db_scripts/create_views.pyindex 3027b38958d..2b34664452d 100644--- a/db_scripts/create_views.py+++ b/db_scripts/create_views.py@@ -15,7 +15,7 @@ db = Prisma()-async def check_view_exists(): # noqa: PLR0915+async def check_view_exists():"""Checks if the LiteLLM_VerificationTokenView and MonthlyGlobalSpend exists in the user's db.@@ -34,8 +34,7 @@ async def check_view_exists(): # noqa: PLR0915print("LiteLLM_VerificationTokenView Exists!") # noqaexcept Exception:# If an error occurs, the view does not exist, so create it- await db.execute_raw(- """+ await db.execute_raw("""CREATE VIEW "LiteLLM_VerificationTokenView" ASSELECTv.*,@@ -45,8 +44,7 @@ async def check_view_exists(): # noqa: PLR0915t.rpm_limit AS team_rpm_limitFROM "LiteLLM_VerificationToken" vLEFT JOIN "LiteLLM_TeamTable" t ON v.team_id = t.team_id;- """- )+ """)print("LiteLLM_VerificationTokenView Created!") # noqadiff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.pyindex a1f63f388b4..6830147116d 100644--- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py+++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py@@ -412,7 +412,7 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):detail=f"User {user_api_key_dict.user_id} does not have access to the file {file_id}",)- async def async_pre_call_hook( # noqa: PLR0915+ async def async_pre_call_hook(self,user_api_key_dict: UserAPIKeyAuth,cache: DualCache,diff --git a/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py b/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.pyindex 75229bacc8f..a057df65500 100644--- a/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py+++ b/enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py@@ -483,7 +483,7 @@ async def new_project(response_model=LiteLLM_ProjectTable,)@management_endpoint_wrapper-async def update_project( # noqa: PLR0915+async def update_project(data: UpdateProjectRequest,http_request: Request,user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),diff --git a/litellm/_redis.py b/litellm/_redis.pyindex e2b04f795cb..1b6e1a5e4b0 100644--- a/litellm/_redis.py+++ b/litellm/_redis.py@@ -311,7 +311,7 @@ def get_redis_url_from_environment():return f"{redis_protocol}://{auth_part}{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}"-def _get_redis_client_logic(**env_overrides): # noqa: PLR0915+def _get_redis_client_logic(**env_overrides):"""Common functionality across sync + async redis client implementations"""diff --git a/litellm/a2a_protocol/main.py b/litellm/a2a_protocol/main.pyindex dcb5cb74ec4..2b6f2cd12b4 100644--- a/litellm/a2a_protocol/main.py+++ b/litellm/a2a_protocol/main.py@@ -436,7 +436,7 @@ def _build_streaming_logging_obj(return logging_obj-async def asend_message_streaming( # noqa: PLR0915+async def asend_message_streaming(a2a_client: Optional["A2AClientType"] = None,request: Optional["SendStreamingMessageRequest"] = None,api_base: Optional[str] = None,diff --git a/litellm/batches/main.py b/litellm/batches/main.pyindex 15ee9303969..f124882b5a4 100644--- a/litellm/batches/main.py+++ b/litellm/batches/main.py@@ -157,7 +157,7 @@ async def acreate_batch(@client-def create_batch( # noqa: PLR0915+def create_batch(completion_window: Literal["24h"],endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],input_file_id: str,diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.pyindex 48691335b40..2a8bd856040 100644--- a/litellm/caching/caching_handler.py+++ b/litellm/caching/caching_handler.py@@ -394,7 +394,7 @@ class LLMCachingHandler:return cr["model"]return None- def _process_async_embedding_cached_response( # noqa: PLR0915+ def _process_async_embedding_cached_response(self,final_embedding_cached_response: Optional[EmbeddingResponse],cached_result: List[Optional[CachedEmbedding]],diff --git a/litellm/caching/qdrant_semantic_cache.py b/litellm/caching/qdrant_semantic_cache.pyindex cb521efca05..68d3b8c20b3 100644--- a/litellm/caching/qdrant_semantic_cache.py+++ b/litellm/caching/qdrant_semantic_cache.py@@ -28,7 +28,7 @@ from .base_cache import BaseCacheclass QdrantSemanticCache(BaseCache):CACHE_KEY_FIELD_NAME = "litellm_cache_key"- def __init__( # noqa: PLR0915+ def __init__(self,qdrant_api_base=None,qdrant_api_key=None,diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.pyindex dabf09f8b2a..3fa6b983e5f 100644--- a/litellm/completion_extras/litellm_responses_transformation/transformation.py+++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py@@ -1211,7 +1211,7 @@ class OpenAiResponsesToChatCompletionStreamIterator(BaseModelResponseIterator):return self.chunk_parser(json.loads(str_line))@staticmethod- def translate_responses_chunk_to_openai_stream( # noqa: PLR0915+ def translate_responses_chunk_to_openai_stream(parsed_chunk: Union[dict, BaseModel],) -> "ModelResponseStream":"""diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.pyindex e934c6a6f83..5c77400651b 100644--- a/litellm/cost_calculator.py+++ b/litellm/cost_calculator.py@@ -288,7 +288,7 @@ def _transcription_usage_has_token_details(return (prompt_tokens_val > 0) or (completion_tokens_val > 0)-def cost_per_token( # noqa: PLR0915+def cost_per_token(model: str = "",prompt_tokens: int = 0,completion_tokens: int = 0,@@ -1136,7 +1136,7 @@ def _store_cost_breakdown_in_logging_obj(pass-def completion_cost( # noqa: PLR0915+def completion_cost(completion_response=None,model: Optional[str] = None,prompt="",diff --git a/litellm/images/main.py b/litellm/images/main.pyindex d95b7287d20..8b108ded4c9 100644--- a/litellm/images/main.py+++ b/litellm/images/main.py@@ -195,7 +195,7 @@ def image_generation(@client-def image_generation( # noqa: PLR0915+def image_generation(prompt: str,model: Optional[str] = None,n: Optional[int] = None,@@ -738,7 +738,7 @@ def image_variation(@client-def image_edit( # noqa: PLR0915+def image_edit(image: Optional[Union[FileTypes, List[FileTypes]]] = None,prompt: Optional[str] = None,model: Optional[str] = None,diff --git a/litellm/integrations/SlackAlerting/slack_alerting.py b/litellm/integrations/SlackAlerting/slack_alerting.pyindex e7be004e62e..2108ebae312 100644--- a/litellm/integrations/SlackAlerting/slack_alerting.py+++ b/litellm/integrations/SlackAlerting/slack_alerting.py@@ -351,7 +351,7 @@ class SlackAlerting(CustomBatchLogger):except Exception:return 0- async def send_daily_reports(self, router) -> bool: # noqa: PLR0915+ async def send_daily_reports(self, router) -> bool:"""Send a daily report on:- Top 5 deployments with most failed requests@@ -1373,7 +1373,7 @@ Model Info:return False- async def send_alert( # noqa: PLR0915+ async def send_alert(self,message: str,level: Literal["Low", "Medium", "High"],diff --git a/litellm/integrations/braintrust_logging.py b/litellm/integrations/braintrust_logging.pyindex 9b1c5077882..6a6313f72e1 100644--- a/litellm/integrations/braintrust_logging.py+++ b/litellm/integrations/braintrust_logging.py@@ -133,9 +133,7 @@ class BraintrustLogger(CustomLogger):self.default_project_id = project_dict["id"]- def log_success_event( # noqa: PLR0915- self, kwargs, response_obj, start_time, end_time- ):+ def log_success_event(self, kwargs, response_obj, start_time, end_time):verbose_logger.debug("REACHES BRAINTRUST SUCCESS")try:litellm_call_id = kwargs.get("litellm_call_id")@@ -271,9 +269,7 @@ class BraintrustLogger(CustomLogger):except Exception as e:raise e # don't use verbose_logger.exception, if exception is raised- async def async_log_success_event( # noqa: PLR0915- self, kwargs, response_obj, start_time, end_time- ):+ async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):verbose_logger.debug("REACHES BRAINTRUST SUCCESS")try:litellm_call_id = kwargs.get("litellm_call_id")diff --git a/litellm/integrations/langfuse/langfuse.py b/litellm/integrations/langfuse/langfuse.pyindex 0efc7d66876..b1c6956a16c 100644--- a/litellm/integrations/langfuse/langfuse.py+++ b/litellm/integrations/langfuse/langfuse.py@@ -549,7 +549,7 @@ class LangFuseLogger:))- def _log_langfuse_v2( # noqa: PLR0915+ def _log_langfuse_v2(self,user_id: Optional[str],metadata: dict,diff --git a/litellm/integrations/mock_client_factory.py b/litellm/integrations/mock_client_factory.pyindex 02a927fe64f..9b912ce70c8 100644--- a/litellm/integrations/mock_client_factory.py+++ b/litellm/integrations/mock_client_factory.py@@ -107,7 +107,7 @@ def _is_url_match(url, matchers: List[str]) -> bool:return False-def create_mock_client_factory(config: MockClientConfig): # noqa: PLR0915+def create_mock_client_factory(config: MockClientConfig):"""Factory function that creates mock client functions based on configuration.diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.pyindex fc37b6a34d8..6b50ef49b49 100644--- a/litellm/integrations/opentelemetry.py+++ b/litellm/integrations/opentelemetry.py@@ -2198,9 +2198,7 @@ class OpenTelemetry(OTELGenAISemconvMixin, CustomLogger):return kv_pairs- def set_attributes( # noqa: PLR0915- self, span: Span, kwargs, response_obj: Optional[Any]- ):+ def set_attributes(self, span: Span, kwargs, response_obj: Optional[Any]):try:if self.callback_name == "langtrace":from litellm.integrations.langtrace import LangtraceAttributesdiff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.pyindex 2119527a8e5..c63f114514a 100644--- a/litellm/integrations/prometheus.py+++ b/litellm/integrations/prometheus.py@@ -75,7 +75,7 @@ class PrometheusLogger(CustomLogger):return cbreturn None- def __init__( # noqa: PLR0915+ def __init__(self,**kwargs,):@@ -2255,7 +2255,7 @@ class PrometheusLogger(CustomLogger):or _litellm_params_metadata.get("user_agent"),}- def set_llm_deployment_failure_metrics(self, request_kwargs: dict): # noqa: PLR0915+ def set_llm_deployment_failure_metrics(self, request_kwargs: dict):"""Sets Failure metrics when an LLM API call failsdiff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex 0d35da9fa1a..6087e55b136 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -234,7 +234,7 @@ def extract_and_raise_litellm_exception()-def exception_type( # type: ignore # noqa: PLR0915+def exception_type( # type: ignoremodel,original_exception,custom_llm_provider,diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.pyindex 182c5117a3e..4941d52d7d6 100644--- a/litellm/litellm_core_utils/get_llm_provider_logic.py+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py@@ -154,7 +154,7 @@ def handle_anthropic_text_model_custom_llm_provider(return model, custom_llm_provider-def get_llm_provider( # noqa: PLR0915+def get_llm_provider(model: str,custom_llm_provider: Optional[str] = None,api_base: Optional[str] = None,@@ -568,7 +568,7 @@ def get_llm_provider( # noqa: PLR0915)-def _get_openai_compatible_provider_info( # noqa: PLR0915+def _get_openai_compatible_provider_info(model: str,api_base: Optional[str],api_key: Optional[str],diff --git a/litellm/litellm_core_utils/get_supported_openai_params.py b/litellm/litellm_core_utils/get_supported_openai_params.pyindex 65c238344e9..e87042b9101 100644--- a/litellm/litellm_core_utils/get_supported_openai_params.py+++ b/litellm/litellm_core_utils/get_supported_openai_params.py@@ -5,7 +5,7 @@ from litellm.exceptions import BadRequestErrorfrom litellm.types.utils import LlmProviders, LlmProvidersSet-def get_supported_openai_params( # noqa: PLR0915+def get_supported_openai_params(model: str,custom_llm_provider: Optional[str] = None,request_type: Literal[diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex 3c525f743ed..0e9c3783316 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -986,7 +986,7 @@ class Logging(LiteLLMLoggingBaseClass):self._get_masked_api_base(additional_args.get("api_base", "")))- def pre_call(self, input, api_key, model=None, additional_args={}): # noqa: PLR0915+ def pre_call(self, input, api_key, model=None, additional_args={}):# Log the exact input to the LLM APIlitellm.error_logs["PRE_CALL"] = locals()try:@@ -2119,7 +2119,7 @@ class Logging(LiteLLMLoggingBaseClass):await self.async_success_handler(result=complete_streaming_response)return- def success_handler( # noqa: PLR0915+ def success_handler(self, result=None, start_time=None, end_time=None, cache_hit=None, **kwargs):verbose_logger.debug(@@ -2584,7 +2584,7 @@ class Logging(LiteLLMLoggingBaseClass):),)- async def async_success_handler( # noqa: PLR0915+ async def async_success_handler(self, result=None, start_time=None, end_time=None, cache_hit=None, **kwargs):"""@@ -3036,7 +3036,7 @@ class Logging(LiteLLMLoggingBaseClass):kwargs=self.model_call_details,) # type: ignore- def failure_handler( # noqa: PLR0915+ def failure_handler(self, exception, traceback_exception, start_time=None, end_time=None):verbose_logger.debug(@@ -3753,7 +3753,7 @@ def _get_masked_values(}-def set_callbacks(callback_list, function_id=None): # noqa: PLR0915+def set_callbacks(callback_list, function_id=None):"""Globally sets the callback client"""@@ -3854,7 +3854,7 @@ def set_callbacks(callback_list, function_id=None): # noqa: PLR0915return None-def _init_custom_logger_compatible_class( # noqa: PLR0915+def _init_custom_logger_compatible_class(logging_integration: _custom_logger_compatible_callbacks_literal,internal_usage_cache: Optional[DualCache],llm_router: Optional[@@ -4611,7 +4611,7 @@ def _maybe_auto_initialize_arize_phoenix(_in_memory_loggers: list) -> None:)-def get_custom_logger_compatible_class( # noqa: PLR0915+def get_custom_logger_compatible_class(logging_integration: _custom_logger_compatible_callbacks_literal,) -> Optional[CustomLogger]:try:diff --git a/litellm/litellm_core_utils/llm_cost_calc/utils.py b/litellm/litellm_core_utils/llm_cost_calc/utils.pyindex d75850984a9..a7ac5b53349 100644--- a/litellm/litellm_core_utils/llm_cost_calc/utils.py+++ b/litellm/litellm_core_utils/llm_cost_calc/utils.py@@ -683,7 +683,7 @@ def _get_regional_uplift_multiplier(return 1.0-def generic_cost_per_token( # noqa: PLR0915+def generic_cost_per_token(model: str,usage: Usage,custom_llm_provider: str,diff --git a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.pyindex 4e5b53a13d7..016bb6b1e22 100644--- a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py+++ b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py@@ -471,7 +471,7 @@ def _should_convert_tool_call_to_json_mode(return False-def convert_to_model_response_object( # noqa: PLR0915+def convert_to_model_response_object(response_object: Optional[dict] = None,model_response_object: Optional[Union[diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.pyindex 5059e612f2f..b95b73398ac 100644--- a/litellm/litellm_core_utils/prompt_templates/factory.py+++ b/litellm/litellm_core_utils/prompt_templates/factory.py@@ -1475,7 +1475,7 @@ def convert_to_gemini_tool_call_invoke()-def convert_to_gemini_tool_call_result( # noqa: PLR0915+def convert_to_gemini_tool_call_result(message: Union[ChatCompletionToolMessage, ChatCompletionFunctionMessage],last_message_with_tool_calls: Optional[dict],model: Optional[str] = None,@@ -2227,7 +2227,7 @@ def _sanitize_empty_text_content(return message-def _add_missing_tool_results( # noqa: PLR0915+def _add_missing_tool_results(current_message: AllMessageValues,messages: List[AllMessageValues],current_index: int,@@ -2484,7 +2484,7 @@ def sanitize_messages_for_tool_calling(return sanitized_messages-def anthropic_messages_pt( # noqa: PLR0915+def anthropic_messages_pt(messages: List[AllMessageValues],model: str,llm_provider: str,@@ -3278,7 +3278,7 @@ def convert_to_cohere_tool_invoke(tool_calls: list) -> List[ToolCallObject]:return cohere_tool_invoke-def cohere_messages_pt_v2( # noqa: PLR0915+def cohere_messages_pt_v2(messages: List,model: str,llm_provider: str,@@ -4703,7 +4703,7 @@ class BedrockConverseMessagesProcessor:return messages@staticmethod- async def _bedrock_converse_messages_pt_async( # noqa: PLR0915+ async def _bedrock_converse_messages_pt_async(messages: List,model: str,llm_provider: str,@@ -5133,7 +5133,7 @@ class BedrockConverseMessagesProcessor:return assistant_parts-def _bedrock_converse_messages_pt( # noqa: PLR0915+def _bedrock_converse_messages_pt(messages: List,model: str,llm_provider: str,diff --git a/litellm/litellm_core_utils/realtime_streaming.py b/litellm/litellm_core_utils/realtime_streaming.pyindex c8f87d96e2f..c56a70177bf 100644--- a/litellm/litellm_core_utils/realtime_streaming.py+++ b/litellm/litellm_core_utils/realtime_streaming.py@@ -1198,7 +1198,7 @@ class RealTimeStreaming:item["content"] = new_contentreturn item- async def client_ack_messages(self): # noqa: PLR0915+ async def client_ack_messages(self):try:while True:message = await self.websocket.receive_text()diff --git a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py b/litellm/litellm_core_utils/streaming_chunk_builder_utils.pyindex d51b937d434..04f6b1241c3 100644--- a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py+++ b/litellm/litellm_core_utils/streaming_chunk_builder_utils.py@@ -209,7 +209,7 @@ class ChunkProcessor:)return response- def get_combined_tool_content( # noqa: PLR0915+ def get_combined_tool_content(self, tool_call_chunks: List[Dict[str, Any]]) -> List[ChatCompletionMessageToolCall]:tool_calls_list: List[ChatCompletionMessageToolCall] = []diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.pyindex 7e4bf895a79..888a9658396 100644--- a/litellm/litellm_core_utils/streaming_handler.py+++ b/litellm/litellm_core_utils/streaming_handler.py@@ -967,7 +967,7 @@ class CustomStreamWrapper:delta, model_response.choices[0].delta, attribute)- def return_processed_chunk_logic( # noqa: PLR0915, C901+ def return_processed_chunk_logic( # noqa: C901self,completion_obj: Dict[str, Any],model_response: ModelResponseStream,@@ -1145,7 +1145,7 @@ class CustomStreamWrapper:del model_response.choices[0].delta.reasoning_contentreturn- def chunk_creator(self, chunk: Any): # type: ignore # noqa: PLR0915+ def chunk_creator(self, chunk: Any): # type: ignoreif hasattr(chunk, "id"):self.response_id = chunk.idmodel_response = self.model_response_creator()@@ -1887,7 +1887,7 @@ class CustomStreamWrapper:model_response.choices[0].finish_reason = "tool_calls"return model_response- def __next__(self) -> "ModelResponseStream": # noqa: PLR0915+ def __next__(self) -> "ModelResponseStream":cache_hit = Falseif (self.custom_llm_provider is not None@@ -2077,7 +2077,7 @@ class CustomStreamWrapper:return self.completion_stream- async def __anext__(self) -> "ModelResponseStream": # noqa: PLR0915+ async def __anext__(self) -> "ModelResponseStream":cache_hit = Falseif (self.custom_llm_provider is not Nonediff --git a/litellm/llms/anthropic/chat/handler.py b/litellm/llms/anthropic/chat/handler.pyindex 2fb29b32a61..5d14f3cc4ae 100644--- a/litellm/llms/anthropic/chat/handler.py+++ b/litellm/llms/anthropic/chat/handler.py@@ -772,7 +772,7 @@ class ModelResponseIterator:)return results- def chunk_parser(self, chunk: dict) -> ModelResponseStream: # noqa: PLR0915+ def chunk_parser(self, chunk: dict) -> ModelResponseStream:try:type_chunk = chunk.get("type", "") or ""diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.pyindex e8c1e659e9f..cf97c946f1c 100644--- a/litellm/llms/anthropic/chat/transformation.py+++ b/litellm/llms/anthropic/chat/transformation.py@@ -605,7 +605,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):)return _tool_choice- def _map_tool_helper( # noqa: PLR0915+ def _map_tool_helper(self,tool: ChatCompletionToolParam,) -> Tuple[Optional[AllAnthropicToolsValues], Optional[AnthropicMcpServerTool]]:@@ -1399,7 +1399,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):return None- def map_openai_params( # noqa: PLR0915+ def map_openai_params(self,non_default_params: dict,optional_params: dict,diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.pyindex f049abcf47f..a8e2fceb4ee 100644--- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py@@ -372,7 +372,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):cache_read_input_tokens=0,)- def __next__(self): # noqa: PLR0915+ def __next__(self):from .transformation import LiteLLMAnthropicMessagesAdaptertry:@@ -618,7 +618,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):)raise StopIteration- async def __anext__(self): # noqa: PLR0915+ async def __anext__(self):from .transformation import LiteLLMAnthropicMessagesAdaptertry:diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.pyindex af868051f4d..bf425637b56 100644--- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py@@ -383,7 +383,7 @@ class LiteLLMAnthropicMessagesAdapter:isinstance(tool_type, str) and tool_type.startswith("web_search")) or tool_name == "web_search"- def translate_anthropic_messages_to_openai( # noqa: PLR0915+ def translate_anthropic_messages_to_openai(self,messages: List[Union[diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py b/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.pyindex 4aae85b17fe..6479ee999b0 100644--- a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py+++ b/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py@@ -97,7 +97,7 @@ def _read_summary_max_tokens_setting() -> int:return COMPACT_SUMMARY_MAX_TOKENS-async def _check_summary_model_access( # noqa: PLR0915+async def _check_summary_model_access(user_api_key_auth: Any,summary_model: str,llm_router: Any,@@ -970,7 +970,7 @@ def apply_client_compaction_block_history()-async def apply_compact_20260112( # noqa: PLR0915+async def apply_compact_20260112(*,model: str,messages: List[Dict[str, Any]],diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.pyindex 5f1362e259f..04819a416a2 100644--- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py+++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py@@ -66,7 +66,7 @@ class AnthropicResponsesStreamWrapper:self._current_block_index += 1return self._current_block_index- def _process_event(self, event: Any) -> None: # noqa: PLR0915+ def _process_event(self, event: Any) -> None:"""Convert one Responses API event into zero or more Anthropic chunks queued for emission."""event_type = getattr(event, "type", None)if event_type is None and isinstance(event, dict):diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.pyindex 2badc2a3276..4fb1ddf5c46 100644--- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py+++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py@@ -51,7 +51,7 @@ class LiteLLMAnthropicToResponsesAPIAdapter:return source.get("url")return None- def translate_messages_to_responses_input( # noqa: PLR0915+ def translate_messages_to_responses_input(self,messages: List[Union[diff --git a/litellm/llms/bedrock/chat/converse_handler.py b/litellm/llms/bedrock/chat/converse_handler.pyindex 7e1020000f4..7b1064ccef9 100644--- a/litellm/llms/bedrock/chat/converse_handler.py+++ b/litellm/llms/bedrock/chat/converse_handler.py@@ -248,7 +248,7 @@ class BedrockConverseLLM(BaseAWSLLM):encoding=encoding,)- def completion( # noqa: PLR0915+ def completion(self,model: str,messages: list,diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.pyindex b5e5e4de6fc..bb261ec85b2 100644--- a/litellm/llms/bedrock/chat/converse_transformation.py+++ b/litellm/llms/bedrock/chat/converse_transformation.py@@ -2189,7 +2189,7 @@ class AmazonConverseConfig(BaseConfig):real_tools = [t for i, t in enumerate(tools) if i not in json_tool_indices]return real_tools if real_tools else None- def _transform_response( # noqa: PLR0915+ def _transform_response(self,model: str,response: httpx.Response,diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.pyindex 0a1322a751e..75b560b4d6d 100644--- a/litellm/llms/bedrock/chat/invoke_handler.py+++ b/litellm/llms/bedrock/chat/invoke_handler.py@@ -473,7 +473,7 @@ class BedrockLLM(BaseAWSLLM):prompt += f"{message['content']}"return prompt, chat_history # type: ignore- def process_response( # noqa: PLR0915+ def process_response(self,model: str,response: httpx.Response,@@ -765,7 +765,7 @@ class BedrockLLM(BaseAWSLLM):return model_response- def completion( # noqa: PLR0915+ def completion(self,model: str,messages: list,diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.pyindex 27dc785bf57..b6aa99842d7 100644--- a/litellm/llms/bedrock/embed/embedding.py+++ b/litellm/llms/bedrock/embed/embedding.py@@ -388,7 +388,7 @@ class BedrockEmbedding(BaseAWSLLM):batch_data=batch_data,)- def embeddings( # noqa: PLR0915+ def embeddings(self,model: str,input: List[str],diff --git a/litellm/llms/bedrock/image_edit/stability_transformation.py b/litellm/llms/bedrock/image_edit/stability_transformation.pyindex 2d73e47003d..d00d62a8530 100644--- a/litellm/llms/bedrock/image_edit/stability_transformation.py+++ b/litellm/llms/bedrock/image_edit/stability_transformation.py@@ -149,7 +149,7 @@ class BedrockStabilityImageEditConfig(BaseImageEditConfig):return mapped_params- def transform_image_edit_request( # noqa: PLR0915+ def transform_image_edit_request(self,model: str,prompt: Optional[str],diff --git a/litellm/llms/bedrock/passthrough/guardrail_translation/handler.py b/litellm/llms/bedrock/passthrough/guardrail_translation/handler.pyindex 2d6bdb5298a..0522bb249e1 100644--- a/litellm/llms/bedrock/passthrough/guardrail_translation/handler.py+++ b/litellm/llms/bedrock/passthrough/guardrail_translation/handler.py@@ -226,7 +226,7 @@ class BedrockPassthroughGuardrailHandler(BaseTranslation):return _is_converse_endpoint(endpoint)@staticmethod- async def de_anonymize_event_stream( # noqa: PLR0915+ async def de_anonymize_event_stream(body_bytes: bytes,proxy_logging_obj: "ProxyLogging",user_api_key_dict: "UserAPIKeyAuth",diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.pyindex 5575385fb28..8ac5b47c6e7 100644--- a/litellm/llms/custom_httpx/llm_http_handler.py+++ b/litellm/llms/custom_httpx/llm_http_handler.py@@ -5676,7 +5676,7 @@ class BaseLLMHTTPHandler:)raise- async def async_responses_websocket( # noqa: PLR0915+ async def async_responses_websocket(self,model: str,websocket: Any,diff --git a/litellm/llms/gemini/realtime/transformation.py b/litellm/llms/gemini/realtime/transformation.pyindex 51fa395d899..74f6cd4d831 100644--- a/litellm/llms/gemini/realtime/transformation.py+++ b/litellm/llms/gemini/realtime/transformation.py@@ -1378,7 +1378,7 @@ class GeminiRealtimeConfig(BaseRealtimeConfig):raise ValueError(f"Unknown openai event: {key}, value: {value}")return openai_event- def transform_realtime_response( # noqa: PLR0915+ def transform_realtime_response(self,message: Union[str, bytes],model: str,diff --git a/litellm/llms/huggingface/embedding/transformation.py b/litellm/llms/huggingface/embedding/transformation.pyindex 88d42cfcdcc..7cddda617a9 100644--- a/litellm/llms/huggingface/embedding/transformation.py+++ b/litellm/llms/huggingface/embedding/transformation.py@@ -404,7 +404,7 @@ class HuggingFaceEmbeddingConfig(BaseConfig):)return completion_response- def convert_to_model_response_object( # noqa: PLR0915+ def convert_to_model_response_object(self,completion_response: Union[List[Dict[str, Any]], Dict[str, Any]],model_response: ModelResponse,diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.pyindex 194f29648c4..ea905d8ebca 100644--- a/litellm/llms/openai/openai.py+++ b/litellm/llms/openai/openai.py@@ -608,7 +608,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM):return streaming_response- def completion( # type: ignore # noqa: PLR0915+ def completion( # type: ignoreself,model_response: ModelResponse,timeout: Union[float, httpx.Timeout],diff --git a/litellm/llms/predibase/chat/transformation.py b/litellm/llms/predibase/chat/transformation.pyindex 3d251d24b0d..ce004f60bfc 100644--- a/litellm/llms/predibase/chat/transformation.py+++ b/litellm/llms/predibase/chat/transformation.py@@ -129,7 +129,7 @@ class PredibaseConfig(BaseConfig):optional_params["response_format"] = valuereturn optional_params- def transform_response( # noqa: PLR0915+ def transform_response(self,model: str,raw_response: Response,diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.pyindex c578d6cd28b..f5a2b268263 100644--- a/litellm/llms/vertex_ai/gemini/transformation.py+++ b/litellm/llms/vertex_ai/gemini/transformation.py@@ -678,7 +678,7 @@ def check_if_part_exists_in_parts(return False-def _gemini_convert_messages_with_history( # noqa: PLR0915+def _gemini_convert_messages_with_history(messages: List[AllMessageValues],model: Optional[str] = None,litellm_params: Optional[dict] = None,@@ -1176,7 +1176,7 @@ def _rewrite_google_maps_response_format(data: RequestBody) -> None:_rewrite_mime_type_to_response_format(generation_config)-def _transform_request_body( # noqa: PLR0915+def _transform_request_body(messages: List[AllMessageValues],model: str,optional_params: dict,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.pyindex 3ec7b0814dd..dab21e2ce8e 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@@ -614,9 +614,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):return googleSearch, googleSearchRetrieval, enterpriseWebSearch, urlContext- def _map_function( # noqa: PLR0915- self, value: List[dict], optional_params: dict- ) -> List[Tools]:+ def _map_function(self, value: List[dict], optional_params: dict) -> List[Tools]:"""Map OpenAI-style tools/functions to Vertex AI format.@@ -1173,7 +1171,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):optional_params["include_server_side_tool_invocations"] = Truereturn- def map_openai_params( # noqa: PLR0915+ def map_openai_params(self,non_default_params: Dict,optional_params: Dict,@@ -1904,7 +1902,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):return False@staticmethod- def _calculate_usage( # noqa: PLR0915+ def _calculate_usage(completion_response: Union[GenerateContentResponseBody, BidiGenerateContentServerMessage],@@ -2380,7 +2378,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):return annotations@staticmethod- def _process_candidates( # noqa: PLR0915+ def _process_candidates(_candidates: List[Candidates],model_response: Union[ModelResponse, "ModelResponseStream"],standard_optional_params: dict,diff --git a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.pyindex 99165c37c93..165dac24903 100644--- a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py+++ b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py@@ -124,7 +124,7 @@ class GoogleBatchEmbeddings(VertexLLM):return resolved_files- def batch_embeddings( # noqa: PLR0915+ def batch_embeddings(self,model: str,input: GeminiEmbeddingInput,diff --git a/litellm/llms/vertex_ai/vertex_ai_non_gemini.py b/litellm/llms/vertex_ai/vertex_ai_non_gemini.pyindex 222820d7ee5..c134dee7ad4 100644--- a/litellm/llms/vertex_ai/vertex_ai_non_gemini.py+++ b/litellm/llms/vertex_ai/vertex_ai_non_gemini.py@@ -77,7 +77,7 @@ def _set_client_in_cache(client_cache_key: str, vertex_llm_model: Any):)-def completion( # noqa: PLR0915+def completion(model: str,messages: list,model_response: ModelResponse,@@ -485,7 +485,7 @@ def completion( # noqa: PLR0915)-async def async_completion( # noqa: PLR0915+async def async_completion(llm_model,mode: str,prompt: str,diff --git a/litellm/main.py b/litellm/main.pyindex a1bade9bb1f..80176cc8b16 100644--- a/litellm/main.py+++ b/litellm/main.py@@ -1086,7 +1086,7 @@ def _build_custom_pricing_entry(@tracer.wrap()@client-def completion( # type: ignore # noqa: PLR0915+def completion( # type: ignoremodel: str,# Optional OpenAI params: see https://platform.openai.com/docs/api-reference/chat/createmessages: List = [],@@ -4878,7 +4878,7 @@ def embedding(@client-def embedding( # noqa: PLR0915+def embedding(model,input=[],# Optional params@@ -6125,7 +6125,7 @@ async def atext_completion(@client-def text_completion( # noqa: PLR0915+def text_completion(prompt: Union[str, List[Union[str, List[Union[str, List[int]]]]]], # Required: The prompt(s) to generate completions for.@@ -6664,7 +6664,7 @@ async def atranscription(*args, **kwargs) -> TranscriptionResponse:@client-def transcription( # noqa: PLR0915+def transcription(model: str,file: FileTypes,## OPTIONAL OPENAI PARAMS ##@@ -6971,7 +6971,7 @@ async def aspeech(*args, **kwargs) -> HttpxBinaryResponseContent:@client-def speech( # noqa: PLR0915+def speech(model: str,input: str,voice: Optional[Union[str, dict]] = None,@@ -7662,7 +7662,7 @@ def stream_chunk_builder_text_completion(return TextCompletionResponse(**response)-def stream_chunk_builder( # noqa: PLR0915+def stream_chunk_builder(chunks: list,messages: Optional[list] = None,start_time=None,diff --git a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.pyindex 1535daeb01d..e47fc84b533 100644--- a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py+++ b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py@@ -125,7 +125,7 @@ class MCPRequestHandler:LITELLM_MCP_ACCESS_GROUPS_HEADER_NAME = SpecialHeaders.mcp_access_groups.value@staticmethod- async def process_mcp_request( # noqa: PLR0915+ async def process_mcp_request(scope: Scope,) -> Tuple[UserAPIKeyAuth,diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex 5e419b5c0a3..3c3f2afad6d 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -3355,7 +3355,7 @@ class MCPServerManager:))- async def _call_regular_mcp_tool( # noqa: PLR0915+ async def _call_regular_mcp_tool(self,mcp_server: MCPServer,original_tool_name: str,diff --git a/litellm/proxy/_experimental/mcp_server/sampling_handler.py b/litellm/proxy/_experimental/mcp_server/sampling_handler.pyindex 1637c9eb0b9..b659ba6f813 100644--- a/litellm/proxy/_experimental/mcp_server/sampling_handler.py+++ b/litellm/proxy/_experimental/mcp_server/sampling_handler.py@@ -661,7 +661,7 @@ def _convert_openai_response_to_mcp_result()-async def _check_model_access( # noqa: PLR0915+async def _check_model_access(model: str, user_api_key_auth: Any) -> Optional["ErrorData"]:"""Enforce model-permission checks for MCP sampling requests.diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.pyindex 746fc4e7d3f..1d9a4479f05 100644--- a/litellm/proxy/_experimental/mcp_server/server.py+++ b/litellm/proxy/_experimental/mcp_server/server.py@@ -617,7 +617,7 @@ if MCP_AVAILABLE:active_mcp_session_var.reset(_session_reset_token)@server.call_tool()- async def mcp_server_tool_call( # noqa: PLR0915+ async def mcp_server_tool_call(name: str, arguments: Dict[str, Any] | None) -> CallToolResult:"""@@ -1591,7 +1591,7 @@ if MCP_AVAILABLE:_mcp_gateway_initialize_instructions.reset(instructions_token)_mcp_gateway_server_name.reset(server_name_token)- async def _get_tools_from_mcp_servers( # noqa: PLR0915+ async def _get_tools_from_mcp_servers(user_api_key_auth: Optional[UserAPIKeyAuth],mcp_auth_header: Optional[str],mcp_servers: Optional[List[str]],@@ -2435,7 +2435,7 @@ if MCP_AVAILABLE:},)- async def execute_mcp_tool( # noqa: PLR0915+ async def execute_mcp_tool(name: str,arguments: Dict[str, Any],allowed_mcp_servers: List[MCPServer],@@ -3642,7 +3642,7 @@ if MCP_AVAILABLE:detail="Forbidden",)- async def handle_streamable_http_mcp( # noqa: PLR0915+ async def handle_streamable_http_mcp(scope: Scope, receive: Receive, send: Send) -> None:"""Handle MCP requests through StreamableHTTP."""diff --git a/litellm/proxy/agent_endpoints/a2a_endpoints.py b/litellm/proxy/agent_endpoints/a2a_endpoints.pyindex 7b2f75e1cff..7446f61ad1c 100644--- a/litellm/proxy/agent_endpoints/a2a_endpoints.py+++ b/litellm/proxy/agent_endpoints/a2a_endpoints.py@@ -509,7 +509,7 @@ async def get_agent_card(tags=["[beta] A2A Agents"],dependencies=[Depends(user_api_key_auth)],)-async def invoke_agent_a2a( # noqa: PLR0915+async def invoke_agent_a2a(agent_id: str,request: Request,fastapi_response: Response,diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.pyindex aa967732a90..814346eddf8 100644--- a/litellm/proxy/auth/auth_checks.py+++ b/litellm/proxy/auth/auth_checks.py@@ -519,7 +519,7 @@ MODEL_DISCOVERY_ROUTES = frozenset()-async def common_checks( # noqa: PLR0915+async def common_checks(request_body: dict,team_object: Optional[LiteLLM_TeamTable],user_object: Optional[LiteLLM_UserTable],diff --git a/litellm/proxy/auth/handle_jwt.py b/litellm/proxy/auth/handle_jwt.pyindex fd6ff2ada7f..90845dfd824 100644--- a/litellm/proxy/auth/handle_jwt.py+++ b/litellm/proxy/auth/handle_jwt.py@@ -1954,7 +1954,7 @@ class JWTAuthManager:return None, None, None@staticmethod- async def auth_builder( # noqa: PLR0915+ async def auth_builder(api_key: str,jwt_handler: JWTHandler,request_data: dict,diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.pyindex 666c01562b5..6f359e52eeb 100644--- a/litellm/proxy/auth/user_api_key_auth.py+++ b/litellm/proxy/auth/user_api_key_auth.py@@ -979,7 +979,7 @@ def _ensure_parent_otel_span_on_request_state(request: Request) -> None:request.state.parent_otel_span = parent_otel_span-async def _user_api_key_auth_builder( # noqa: PLR0915+async def _user_api_key_auth_builder(request: Request,api_key: str,azure_api_key_header: str,@@ -2126,7 +2126,7 @@ def _team_obj_from_token(valid_token: UserAPIKeyAuth) -> LiteLLM_TeamTableCached@tracer.wrap()-async def _run_centralized_common_checks( # noqa: PLR0915+async def _run_centralized_common_checks(user_api_key_auth_obj: UserAPIKeyAuth,request: Request,request_data: dict,diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.pyindex ea479a5721b..344f90aa144 100644--- a/litellm/proxy/batches_endpoints/endpoints.py+++ b/litellm/proxy/batches_endpoints/endpoints.py@@ -58,7 +58,7 @@ router = APIRouter()dependencies=[Depends(user_api_key_auth)],tags=["batch"],)-async def create_batch( # noqa: PLR0915+async def create_batch(request: Request,fastapi_response: Response,provider: Optional[str] = None,@@ -343,7 +343,7 @@ async def create_batch( # noqa: PLR0915dependencies=[Depends(user_api_key_auth)],tags=["batch"],)-async def retrieve_batch( # noqa: PLR0915+async def retrieve_batch(request: Request,fastapi_response: Response,user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.pyindex 8f330ada7d3..41cadd5bbc3 100644--- a/litellm/proxy/common_request_processing.py+++ b/litellm/proxy/common_request_processing.py@@ -300,7 +300,7 @@ class _UpstreamClosingStreamingResponse(StreamingResponse):)-async def create_response( # noqa: PLR0915+async def create_response(generator: AsyncGenerator[str, None],media_type: str,headers: dict,@@ -1148,7 +1148,7 @@ class ProxyBaseLLMRequestProcessing:_payload_str,)- async def base_process_llm_request( # noqa: PLR0915+ async def base_process_llm_request(self,request: Request,fastapi_response: Response,diff --git a/litellm/proxy/common_utils/callback_utils.py b/litellm/proxy/common_utils/callback_utils.pyindex ab1eeaf1646..71dce163b78 100644--- a/litellm/proxy/common_utils/callback_utils.py+++ b/litellm/proxy/common_utils/callback_utils.py@@ -36,7 +36,7 @@ if TYPE_CHECKING:from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLogging-def initialize_callbacks_on_proxy( # noqa: PLR0915+def initialize_callbacks_on_proxy(value: Any,premium_user: bool,config_file_path: str,diff --git a/litellm/proxy/db/create_views.py b/litellm/proxy/db/create_views.pyindex 97525a528d0..d9e21fc5d2a 100644--- a/litellm/proxy/db/create_views.py+++ b/litellm/proxy/db/create_views.py@@ -11,7 +11,7 @@ _db = Any_VIEW_NOT_FOUND_MARKERS = ("does not exist", "no such table", "undefined table")-async def create_missing_views(db: _db): # noqa: PLR0915+async def create_missing_views(db: _db):"""--------------------------------------------------NOTE: Copy of `litellm/db_scripts/create_views.py`.diff --git a/litellm/proxy/db/db_spend_update_writer.py b/litellm/proxy/db/db_spend_update_writer.pyindex e7f14df5294..4b7b20d75d0 100644--- a/litellm/proxy/db/db_spend_update_writer.py+++ b/litellm/proxy/db/db_spend_update_writer.py@@ -1128,7 +1128,7 @@ class DBSpendUpdateWriter:"_flush_tool_discovery_queue error (non-blocking): %s", e)- async def _commit_spend_updates_to_db( # noqa: PLR0915+ async def _commit_spend_updates_to_db(self,prisma_client: PrismaClient,n_retry_times: int,diff --git a/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py b/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.pyindex ff802223f21..72b9b7dc3c1 100644--- a/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py+++ b/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py@@ -121,7 +121,7 @@ class lakeraAI_Moderation(CustomGuardrail):return None- async def _check( # noqa: PLR0915+ async def _check(self,data: dict,user_api_key_dict: UserAPIKeyAuth,diff --git a/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py b/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.pyindex e5200394b55..e8887fa712a 100644--- a/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py+++ b/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py@@ -261,7 +261,7 @@ class PanwPrismaAirsHandler(CustomGuardrail):)return ""- async def _call_panw_api( # noqa: PLR0915+ async def _call_panw_api(self,content: str = "",is_response: bool = False,@@ -1762,7 +1762,7 @@ class PanwPrismaAirsHandler(CustomGuardrail):return rd.get("name") if ("arguments" in rd or "mcp_arguments" in rd) else None@log_guardrail_information- async def apply_guardrail( # noqa: PLR0915+ async def apply_guardrail(self,inputs: GenericGuardrailAPIInputs,request_data: dict,diff --git a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.pyindex 2a2c758fa8a..09fff71062b 100644--- a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py+++ b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py@@ -288,7 +288,7 @@ class UnifiedLLMGuardrails(CustomLogger):return response- async def async_post_call_streaming_iterator_hook( # noqa: PLR0915+ async def async_post_call_streaming_iterator_hook(self,user_api_key_dict: UserAPIKeyAuth,response: Any,diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.pyindex e0d018d4344..8a432eb2f42 100644--- a/litellm/proxy/health_endpoints/_health_endpoints.py+++ b/litellm/proxy/health_endpoints/_health_endpoints.py@@ -167,7 +167,7 @@ async def test_endpoint(request: Request):tags=["health"],dependencies=[Depends(user_api_key_auth)],)-async def health_services_endpoint( # noqa: PLR0915+async def health_services_endpoint(user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),service: services = fastapi.Query(description="Specify the service being hit."),):diff --git a/litellm/proxy/hooks/parallel_request_limiter.py b/litellm/proxy/hooks/parallel_request_limiter.pyindex 23af23e78bd..d36e9858b5a 100644--- a/litellm/proxy/hooks/parallel_request_limiter.py+++ b/litellm/proxy/hooks/parallel_request_limiter.py@@ -239,7 +239,7 @@ class _PROXY_MaxParallelRequestsHandler(CustomLogger):request_count_end_user_id=results[5],)- async def async_pre_call_hook( # noqa: PLR0915+ async def async_pre_call_hook(self,user_api_key_dict: UserAPIKeyAuth,cache: DualCache,@@ -506,9 +506,7 @@ class _PROXY_MaxParallelRequestsHandler(CustomLogger):return- async def async_log_success_event( # noqa: PLR0915- self, kwargs, response_obj, start_time, end_time- ):+ async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):from litellm.proxy.common_utils.callback_utils import (get_model_group_from_litellm_kwargs,)diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.pyindex 0587ce1cc29..0e21fd8e1f0 100644--- a/litellm/proxy/litellm_pre_call_utils.py+++ b/litellm/proxy/litellm_pre_call_utils.py@@ -1317,7 +1317,7 @@ class LiteLLMProxyRequestSetup:)-async def add_litellm_data_to_request( # noqa: PLR0915+async def add_litellm_data_to_request(data: dict,request: Request,user_api_key_dict: UserAPIKeyAuth,diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.pyindex 13107b68864..e258ddc0410 100644--- a/litellm/proxy/management_endpoints/common_daily_activity.py+++ b/litellm/proxy/management_endpoints/common_daily_activity.py@@ -726,7 +726,7 @@ def _key_metadata(return KeyMetadata(key_alias=meta.get("key_alias"), team_id=meta.get("team_id"))-def _aggregate_grouping_sets_records_sync( # noqa: PLR0915+def _aggregate_grouping_sets_records_sync(*,records: List[Any],api_key_metadata: Dict[str, Dict[str, Any]],diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.pyindex b0210e1123f..132060be76b 100644--- a/litellm/proxy/management_endpoints/key_management_endpoints.py+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py@@ -675,7 +675,7 @@ def _enforce_upperbound_key_params()-async def _common_key_generation_helper( # noqa: PLR0915+async def _common_key_generation_helper(data: GenerateKeyRequest,user_api_key_dict: UserAPIKeyAuth,litellm_changed_by: Optional[str],@@ -3419,7 +3419,7 @@ def _check_model_access_group(return True-async def generate_key_helper_fn( # noqa: PLR0915+async def generate_key_helper_fn(request_type: Literal["user", "key"], # identifies if this request is from /user/new or /key/generate@@ -4070,7 +4070,7 @@ async def delete_key_aliases()-async def _rotate_master_key( # noqa: PLR0915+async def _rotate_master_key(prisma_client: PrismaClient,user_api_key_dict: UserAPIKeyAuth,current_master_key: str,diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.pyindex 85b640d6b6c..4d4d1ef2774 100644--- a/litellm/proxy/management_endpoints/team_endpoints.py+++ b/litellm/proxy/management_endpoints/team_endpoints.py@@ -933,7 +933,7 @@ def _check_team_budget_update_authority(response_model=LiteLLM_TeamTable,)@management_endpoint_wrapper-async def new_team( # noqa: PLR0915+async def new_team(data: NewTeamRequest,http_request: Request,user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),@@ -1637,7 +1637,7 @@ def validate_team_org_change("/team/update", tags=["team management"], dependencies=[Depends(user_api_key_auth)])@management_endpoint_wrapper-async def update_team( # noqa: PLR0915+async def update_team(data: UpdateTeamRequest,http_request: Request,user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.pyindex 5af1dd321ed..2bf12880a75 100644--- a/litellm/proxy/management_endpoints/ui_sso.py+++ b/litellm/proxy/management_endpoints/ui_sso.py@@ -3145,7 +3145,7 @@ class SSOAuthenticationHandler:)@staticmethod- async def get_redirect_response_from_openid( # noqa: PLR0915+ async def get_redirect_response_from_openid(result: Union[OpenID, dict, CustomOpenID],request: Request,received_response: Optional[dict] = None,diff --git a/litellm/proxy/openai_files_endpoints/files_endpoints.py b/litellm/proxy/openai_files_endpoints/files_endpoints.pyindex 3e5873c2655..f43e876d111 100644--- a/litellm/proxy/openai_files_endpoints/files_endpoints.py+++ b/litellm/proxy/openai_files_endpoints/files_endpoints.py@@ -284,7 +284,7 @@ async def route_create_file(dependencies=[Depends(user_api_key_auth)],tags=["files"],)-async def create_file( # noqa: PLR0915+async def create_file(request: Request,fastapi_response: Response,purpose: str = Form(...),@@ -589,7 +589,7 @@ async def create_file( # noqa: PLR0915dependencies=[Depends(user_api_key_auth)],tags=["files"],)-async def get_file_content( # noqa: PLR0915+async def get_file_content(request: Request,fastapi_response: Response,file_id: str,diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.pyindex a912a88a993..6feb4e36bf9 100644--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py@@ -366,7 +366,7 @@ class AnthropicPassthroughLoggingHandler:)@staticmethod- def _collapse_pure_text_chunks( # noqa: PLR0915+ def _collapse_pure_text_chunks(all_chunks: Sequence[Union[str, bytes]],) -> Optional[List[str]]:"""@@ -551,7 +551,7 @@ class AnthropicPassthroughLoggingHandler:return complete_streaming_response@staticmethod- def batch_creation_handler( # noqa: PLR0915+ def batch_creation_handler(httpx_response: httpx.Response,logging_obj: LiteLLMLoggingObj,url_route: str,diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.pyindex 9f353226dd0..b77c6e2f655 100644--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py@@ -275,7 +275,7 @@ class OpenAIPassthroughLoggingHandler(BasePassthroughLoggingHandler):return litellm_model_response, response_cost@staticmethod- def openai_passthrough_handler( # noqa: PLR0915+ def openai_passthrough_handler(httpx_response: httpx.Response,response_body: dict,logging_obj: LiteLLMLoggingObj,diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.pyindex 6a138532617..73d4245670a 100644--- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py+++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py@@ -645,7 +645,7 @@ class VertexPassthroughLoggingHandler:return kwargs@staticmethod- def batch_prediction_jobs_handler( # noqa: PLR0915+ def batch_prediction_jobs_handler(httpx_response: httpx.Response,logging_obj: LiteLLMLoggingObj,url_route: str,diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.pyindex e3cb9dec884..b84746758fb 100644--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py@@ -143,7 +143,7 @@ async def set_env_variables_in_header(custom_headers: Optional[dict]) -> Optionareturn headers-async def chat_completion_pass_through_endpoint( # noqa: PLR0915+async def chat_completion_pass_through_endpoint(fastapi_response: Response,request: Request,adapter_id: str,@@ -701,7 +701,7 @@ from litellm.passthrough.timeout_utils import ()-async def pass_through_request( # noqa: PLR0915+async def pass_through_request(request: Request,target: str,custom_headers: dict,@@ -1540,7 +1540,7 @@ async def _parse_request_data_by_content_type(return query_params_data, custom_body_data, file_data, stream-def create_pass_through_route( # noqa: PLR0915+def create_pass_through_route(endpoint,target: str,custom_headers: Optional[Mapping[str, Any]] = None,@@ -1776,7 +1776,7 @@ def create_websocket_passthrough_route(return websocket_endpoint_func-async def websocket_passthrough_request( # noqa: PLR0915+async def websocket_passthrough_request(websocket: WebSocket,target: str,custom_headers: dict,diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.pyindex bd9746d2a47..e1fb65074cd 100644--- a/litellm/proxy/proxy_cli.py+++ b/litellm/proxy/proxy_cli.py@@ -814,7 +814,7 @@ class ProxyInitializationHelpers:default=False,help="Enable uvicorn hot reload (dev only). Also reloads when the --config YAML file changes. Incompatible with --num_workers>1, --run_gunicorn, and --run_hypercorn.",)-def run_server( # noqa: PLR0915+def run_server(cli_args,host,port,diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 1f765aa8d63..a48e9c58861 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -745,7 +745,7 @@ async def _initialize_shared_aiohttp_session():@asynccontextmanager-async def proxy_startup_event(app: FastAPI): # noqa: PLR0915+async def proxy_startup_event(app: FastAPI):global prisma_client, master_key, use_background_health_checks, llm_router, llm_model_list, general_settings, proxy_budget_rescheduler_min_time, proxy_budget_rescheduler_max_time, litellm_proxy_admin_name, db_writer_client, store_model_in_db, premium_user, _license_check, proxy_batch_polling_interval, shared_aiohttp_sessionimport json@@ -2496,7 +2496,7 @@ async def _invalidate_spend_counter(counter_key: str):)-async def update_cache( # noqa: PLR0915+async def update_cache(token: Optional[str],user_id: Optional[str],end_user_id: Optional[str],@@ -3900,7 +3900,7 @@ class ProxyConfig:premium_user = _license_check.is_premium()return- async def load_config( # noqa: PLR0915+ async def load_config(self, router: Optional[litellm.Router], config_file_path: str):"""@@ -6631,7 +6631,7 @@ def save_worker_config(**data):os.environ["WORKER_CONFIG"] = json.dumps(data)-async def initialize( # noqa: PLR0915+async def initialize(model=None,alias=None,api_base=None,@@ -7022,7 +7022,7 @@ def _format_streaming_sse_chunk(chunk: Union[str, bytes]) -> Union[str, bytes]:return f"data: {chunk}\n\n"-async def async_data_generator( # noqa: PLR0915+async def async_data_generator(response, user_api_key_dict: UserAPIKeyAuth, request_data: dict):verbose_proxy_logger.debug("inside generator")@@ -7470,7 +7470,7 @@ class ProxyStartupEvent:)@classmethod- async def initialize_scheduled_background_jobs( # noqa: PLR0915+ async def initialize_scheduled_background_jobs(cls,general_settings: dict,prisma_client: PrismaClient,@@ -8681,7 +8681,7 @@ async def chat_completion(dependencies=[Depends(user_api_key_auth)],tags=["completions"],)-async def completion( # noqa: PLR0915+async def completion(request: Request,fastapi_response: Response,model: Optional[str] = None,@@ -14411,7 +14411,7 @@ async def invitation_delete(dependencies=[Depends(user_api_key_auth)],include_in_schema=False,)-async def update_config( # noqa: PLR0915+async def update_config(config_info: ConfigYAML,user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),):@@ -15028,7 +15028,7 @@ async def delete_callback(include_in_schema=False,dependencies=[Depends(user_api_key_auth)],)-async def get_config(): # noqa: PLR0915+async def get_config():"""For Admin UI - allows admin to view config via UI# return the callbacks and the env variables for the callbackdiff --git a/litellm/proxy/response_polling/background_streaming.py b/litellm/proxy/response_polling/background_streaming.pyindex 03039d4f441..a69e6734d71 100644--- a/litellm/proxy/response_polling/background_streaming.py+++ b/litellm/proxy/response_polling/background_streaming.py@@ -21,7 +21,7 @@ from litellm.proxy.response_polling.polling_handler import ResponsePollingHandlefrom litellm.types.llms.openai import ResponsesAPIStatus-async def background_streaming_task( # noqa: PLR0915+async def background_streaming_task(polling_id: str,data: dict,polling_handler: ResponsePollingHandler,diff --git a/litellm/proxy/route_llm_request.py b/litellm/proxy/route_llm_request.pyindex 3626a21516d..bbd8b75fdd6 100644--- a/litellm/proxy/route_llm_request.py+++ b/litellm/proxy/route_llm_request.py@@ -264,7 +264,7 @@ async def add_shared_session_to_data(data: dict) -> None:pass-async def route_request( # noqa: PLR0915 - Complex routing function, refactoring tracked separately+async def route_request(data: dict,llm_router: Optional[LitellmRouter],user_model: Optional[str],diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.pyindex ef06adb27fc..0ba77dcd2f0 100644--- a/litellm/proxy/spend_tracking/spend_management_endpoints.py+++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py@@ -1734,7 +1734,7 @@ async def calculate_spend(request: SpendCalculateRequest):200: {"model": List[LiteLLM_SpendLogs]},},)-async def ui_view_spend_logs( # noqa: PLR0915+async def ui_view_spend_logs(request: Request,api_key: Optional[str] = fastapi.Query(default=None,@@ -2273,7 +2273,7 @@ async def ui_view_request_response_for_request_id(200: {"model": List[LiteLLM_SpendLogs]},},)-async def view_spend_logs( # noqa: PLR0915+async def view_spend_logs(api_key: Optional[str] = fastapi.Query(default=None,description="Get spend logs based on api key",diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.pyindex d215294fd04..aef06a3c668 100644--- a/litellm/proxy/spend_tracking/spend_tracking_utils.py+++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py@@ -228,9 +228,7 @@ def _extract_usage_for_ocr_call(response_obj: Any, response_obj_dict: dict) -> dreturn {}-def get_logging_payload( # noqa: PLR0915- kwargs, response_obj, start_time, end_time-) -> SpendLogsPayload:+def get_logging_payload(kwargs, response_obj, start_time, end_time) -> SpendLogsPayload:if kwargs is None:kwargs = {}diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.pyindex 7031ecaa1a0..f6f0a92def0 100644--- a/litellm/realtime_api/main.py+++ b/litellm/realtime_api/main.py@@ -284,7 +284,7 @@ async def arealtime_calls(@wrapper_client-async def _arealtime( # noqa: PLR0915+async def _arealtime(model: str,websocket: Any, # fastapi websocketapi_base: Optional[str] = None,diff --git a/litellm/rerank_api/main.py b/litellm/rerank_api/main.pyindex e27585116ce..e40e12e9197 100644--- a/litellm/rerank_api/main.py+++ b/litellm/rerank_api/main.py@@ -75,7 +75,7 @@ async def arerank(@client-def rerank( # noqa: PLR0915+def rerank(model: str,query: str,documents: List[Union[str, Dict[str, Any]]],diff --git a/litellm/responses/mcp/chat_completions_handler.py b/litellm/responses/mcp/chat_completions_handler.pyindex 24b5db28571..acb7487f430 100644--- a/litellm/responses/mcp/chat_completions_handler.py+++ b/litellm/responses/mcp/chat_completions_handler.py@@ -77,7 +77,7 @@ def _add_mcp_metadata_to_response(setattr(message, "provider_specific_fields", provider_fields)-async def acompletion_with_mcp( # noqa: PLR0915+async def acompletion_with_mcp(model: str,messages: List,tools: Optional[List] = None,diff --git a/litellm/responses/mcp/litellm_proxy_mcp_handler.py b/litellm/responses/mcp/litellm_proxy_mcp_handler.pyindex 94cff6922b5..df5de205d45 100644--- a/litellm/responses/mcp/litellm_proxy_mcp_handler.py+++ b/litellm/responses/mcp/litellm_proxy_mcp_handler.py@@ -644,7 +644,7 @@ class LiteLLM_Proxy_MCP_Handler:return result_text or "Tool executed successfully"@staticmethod- async def _execute_tool_calls( # noqa: PLR0915+ async def _execute_tool_calls(tool_server_map: dict[str, str],tool_calls: List[Any],user_api_key_auth: Any,diff --git a/litellm/router.py b/litellm/router.pyindex 5c4dc3eb943..5f26097443f 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -241,7 +241,7 @@ class Router:lowesttpm_logger: Optional[LowestTPMLoggingHandler] = Noneoptional_callbacks: Optional[List[Union[CustomLogger, Callable, str]]] = None- def __init__( # noqa: PLR0915+ def __init__(self,model_list: Optional[Union[List[DeploymentTypedDict], List[Dict[str, Any]]]@@ -2887,7 +2887,7 @@ class Router:f"Silent experiment failed for model {silent_model}: {str(e)}")- async def _acompletion( # noqa: PLR0915+ async def _acompletion(self, model: str, messages: List[Dict[str, str]], **kwargs) -> Union[ModelResponse,@@ -5158,7 +5158,7 @@ class Router:)raise e- async def _acreate_file( # noqa: PLR0915+ async def _acreate_file(self,model: str,**kwargs,@@ -6467,7 +6467,7 @@ class Router:# propagate so they remain visible.return None- async def async_function_with_fallbacks_common_utils( # noqa: PLR0915+ async def async_function_with_fallbacks_common_utils(self,e: Exception,disable_fallbacks: Optional[bool],@@ -6843,7 +6843,7 @@ class Router:)@tracer.wrap()- async def async_function_with_retries(self, *args, **kwargs): # noqa: PLR0915+ async def async_function_with_retries(self, *args, **kwargs):verbose_router_logger.debug("Inside async function with retries.")original_function = kwargs.pop("original_function")fallbacks = kwargs.pop("fallbacks", self.fallbacks)@@ -9324,7 +9324,7 @@ class Router:return model_info- def _set_model_group_info( # noqa: PLR0915+ def _set_model_group_info(self, model_group: str, user_facing_model_group_name: str) -> Optional[ModelGroupInfo]:"""@@ -10566,7 +10566,7 @@ class Router:)return client- def _pre_call_checks( # noqa: PLR0915+ def _pre_call_checks(self,model: str,healthy_deployments: List,diff --git a/litellm/router_strategy/lowest_cost.py b/litellm/router_strategy/lowest_cost.pyindex 54498363f51..3f641d4f0fb 100644--- a/litellm/router_strategy/lowest_cost.py+++ b/litellm/router_strategy/lowest_cost.py@@ -190,7 +190,7 @@ class LowestCostLoggingHandler(CustomLogger):)pass- async def async_get_available_deployments( # noqa: PLR0915+ async def async_get_available_deployments(self,model_group: str,healthy_deployments: list,diff --git a/litellm/router_strategy/lowest_latency.py b/litellm/router_strategy/lowest_latency.pyindex 870b3f29d48..3adb8d43920 100644--- a/litellm/router_strategy/lowest_latency.py+++ b/litellm/router_strategy/lowest_latency.py@@ -35,9 +35,7 @@ class LowestLatencyLoggingHandler(CustomLogger):self.router_cache = router_cacheself.routing_args = RoutingArgs(**routing_args)- def log_success_event( # noqa: PLR0915- self, kwargs, response_obj, start_time, end_time- ):+ def log_success_event(self, kwargs, response_obj, start_time, end_time):try:"""Update latency usage on success@@ -259,9 +257,7 @@ class LowestLatencyLoggingHandler(CustomLogger):)pass- async def async_log_success_event( # noqa: PLR0915- self, kwargs, response_obj, start_time, end_time- ):+ async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):try:"""Update latency usage on success@@ -413,7 +409,7 @@ class LowestLatencyLoggingHandler(CustomLogger):)pass- def _get_available_deployments( # noqa: PLR0915+ def _get_available_deployments(self,model_group: str,healthy_deployments: list,diff --git a/litellm/router_strategy/lowest_tpm_rpm.py b/litellm/router_strategy/lowest_tpm_rpm.pyindex 488f8450941..f807ba7232a 100644--- a/litellm/router_strategy/lowest_tpm_rpm.py+++ b/litellm/router_strategy/lowest_tpm_rpm.py@@ -158,7 +158,7 @@ class LowestTPMLoggingHandler(CustomLogger):verbose_router_logger.debug(traceback.format_exc())pass- def get_available_deployments( # noqa: PLR0915+ def get_available_deployments(self,model_group: str,healthy_deployments: list,diff --git a/litellm/secret_managers/main.py b/litellm/secret_managers/main.pyindex 5c31d81f04c..f4b1d4a1b69 100644--- a/litellm/secret_managers/main.py+++ b/litellm/secret_managers/main.py@@ -156,7 +156,7 @@ def get_secret_bool(return str_to_bool(_secret_value)-def get_secret( # noqa: PLR0915+def get_secret(secret_name: str,default_value: Optional[Union[str, bool]] = None,):diff --git a/litellm/secret_managers/secret_manager_handler.py b/litellm/secret_managers/secret_manager_handler.pyindex 4ff94d18eff..3a3cf6272dc 100644--- a/litellm/secret_managers/secret_manager_handler.py+++ b/litellm/secret_managers/secret_manager_handler.py@@ -23,7 +23,7 @@ def _is_base64(s):return False-def get_secret_from_manager( # noqa: PLR0915+def get_secret_from_manager(client: Any,key_manager: str,secret_name: str,diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex a5032942011..f2152577b4d 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -1572,7 +1572,7 @@ class Usage(SafeAttributeModel, CompletionUsage):prompt_tokens_details: Optional[PromptTokensDetailsWrapper] = None"""Breakdown of tokens used in the prompt."""- def __init__( # noqa: PLR0915+ def __init__(self,prompt_tokens: Optional[int] = None,completion_tokens: Optional[int] = None,@@ -1908,7 +1908,7 @@ class ModelResponse(ModelResponseBase):choices: List[Choices]"""The list of completion choices the model generated for the input prompt."""- def __init__( # noqa: PLR0915+ def __init__(self,id=None,choices=None,diff --git a/litellm/utils.py b/litellm/utils.pyindex ee7d952008e..9c5989a11d3 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -760,7 +760,7 @@ def _remove_thought_signatures_from_messages(return processed_messages-def function_setup( # noqa: PLR0915+def function_setup(original_function: str, rules_obj, start_time, *args, **kwargs): # just run once to check if user wants to send their data anywhere - PostHog/Sentry/Slack/etc.### NOTICES ###@@ -1422,12 +1422,12 @@ def post_call_processing(raise e-def client(original_function): # noqa: PLR0915+def client(original_function):Rules = getattr(sys.modules[__name__], "Rules")rules_obj = Rules()@wraps(original_function)- def wrapper(*args, **kwargs): # noqa: PLR0915+ def wrapper(*args, **kwargs):# DO NOT MOVE THIS. It always needs to run first# Check if this is an async function. If so only execute the async functioncall_type = original_function.__name__@@ -1775,7 +1775,7 @@ def client(original_function): # noqa: PLR0915raise e@wraps(original_function)- async def wrapper_async(*args, **kwargs): # noqa: PLR0915+ async def wrapper_async(*args, **kwargs):print_args_passed_to_litellm(original_function, args, kwargs)start_time = datetime.datetime.now()result = None@@ -2942,7 +2942,7 @@ def _resolve_builtin_model_cost_entry(return None-def register_model(model_cost: Union[str, dict]): # noqa: PLR0915+def register_model(model_cost: Union[str, dict]):"""Register new / Override existing models (and their pricing) to specific providers.Provide EITHER a model cost dictionary or a url to a hosted json blob@@ -3365,7 +3365,7 @@ def get_optional_params_image_gen(return optional_params-def get_optional_params_embeddings( # noqa: PLR0915+def get_optional_params_embeddings(# 2 optional paramsmodel: str,user: Optional[str] = None,@@ -4112,7 +4112,7 @@ def pre_process_optional_params(return optional_params-def get_optional_params( # noqa: PLR0915+def get_optional_params(# use the openai defaults# https://platform.openai.com/docs/api-reference/chat/createmodel: str,@@ -5842,7 +5842,7 @@ def _is_potential_model_name_in_model_cost()-def _get_model_info_helper( # noqa: PLR0915+def _get_model_info_helper(model: str,custom_llm_provider: Optional[str] = None,api_base: Optional[str] = None,@@ -6566,7 +6566,7 @@ def create_proxy_transport_and_mounts():return sync_proxy_mounts, async_proxy_mounts-def validate_environment( # noqa: PLR0915+def validate_environment(model: Optional[str] = None,api_key: Optional[str] = None,api_base: Optional[str] = None,diff --git a/ruff.toml b/ruff.tomlindex 7baa1c5f92d..2db4122a30e 100644--- a/ruff.toml+++ b/ruff.toml@@ -1,5 +1,5 @@lint.ignore = ["F405", "E402", "E501", "F403"]-lint.extend-select = ["E501", "PLR0915", "T20", "PGH004", "RUF008", "RUF009", "RUF100"]+lint.extend-select = ["E501", "T20", "PGH004", "RUF008", "RUF009", "RUF100"]# RUF100 (unused-noqa) only knows the rules enabled in THIS config, so it would strip# `# noqa` directives that protect rules enforced elsewhere. List those codes as external# so RUF100 leaves their directives alone: the strict gate (ruff-strict.toml) and upstream@@ -23,9 +23,4 @@ exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_conf"litellm/llms/azure_ai/embed/__init__.py" = ["F401"]"litellm/llms/azure_ai/rerank/__init__.py" = ["F401"]"litellm/llms/bedrock/chat/__init__.py" = ["F401"]-"litellm/proxy/utils.py" = ["F401", "PLR0915"]-"litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py" = ["PLR0915"]-"litellm/proxy/guardrails/guardrail_hooks/guardrail_benchmarks/test_eval.py" = ["PLR0915"]-"litellm/responses/streaming_iterator.py" = ["PLR0915"]-"litellm/files/main.py" = ["PLR0915"]-"litellm/llms/litellm_proxy/skills/sandbox_executor.py" = ["PLR0915"]+"litellm/proxy/utils.py" = ["F401"]diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.pyindex 2e4b7f9ae74..362f4986c62 100644--- a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py@@ -1060,7 +1060,7 @@ def test_initialize_pass_through_endpoints_with_cost_per_request():@pytest.mark.asyncio-async def test_pass_through_request_contains_proxy_server_request_in_kwargs(): # noqa: PLR0915+async def test_pass_through_request_contains_proxy_server_request_in_kwargs():"""Test that pass_through_request (parent method) correctly includes proxy_server_requestin kwargs passed to the success handler.