diff --git a/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py b/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py index 21933165217..5e799599862 100644 --- a/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py +++ b/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py @@ -282,6 +282,8 @@ async def get_vector_store_info( updated_at=vector_store.get("updated_at") or None, litellm_credential_name=vector_store.get("litellm_credential_name"), litellm_params=vector_store.get("litellm_params") or None, + team_id=vector_store.get("team_id"), + user_id=vector_store.get("user_id"), ) return {"vector_store": vector_store_pydantic_obj} diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index 8e49c90a595..c48824c3f26 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -748,7 +748,7 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): if isinstance(web_search_options, dict): web_search_tool.update(web_search_options) - responses_api_request["tools"].append(web_search_tool) + responses_api_request["tools"].append(web_search_tool) # type: ignore[union-attr, arg-type] def _transform_response_format_to_text_format( self, response_format: Union[Dict[str, Any], Any] diff --git a/litellm/experimental_mcp_client/client.py b/litellm/experimental_mcp_client/client.py index e2de3cd5021..434f894b846 100644 --- a/litellm/experimental_mcp_client/client.py +++ b/litellm/experimental_mcp_client/client.py @@ -14,7 +14,7 @@ from mcp.client.stdio import stdio_client try: from mcp.client.streamable_http import streamable_http_client # type: ignore except ImportError: - streamable_http_client = None + streamable_http_client = None # type: ignore[assignment] from mcp.types import CallToolRequestParams as MCPCallToolRequestParams from mcp.types import CallToolResult as MCPCallToolResult from mcp.types import ( diff --git a/litellm/files/main.py b/litellm/files/main.py index 93a10dac7a3..9f25a8531ed 100644 --- a/litellm/files/main.py +++ b/litellm/files/main.py @@ -34,7 +34,7 @@ from litellm.types.llms.openai import ( HttpxBinaryResponseContent, OpenAIFileObject, ) -from litellm.types.router import * +import litellm.types.router # noqa: F401 - side effects needed from litellm.types.utils import ( OPENAI_COMPATIBLE_BATCH_AND_FILES_PROVIDERS, LlmProviders, diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py index 997dd044a65..18898be7dce 100644 --- a/litellm/integrations/opentelemetry.py +++ b/litellm/integrations/opentelemetry.py @@ -1631,7 +1631,7 @@ class OpenTelemetry(CustomLogger): ) except Exception as e: - self.handle_callback_failure(callback_name= self.callback_name) + self.handle_callback_failure(callback_name=self.callback_name or "opentelemetry") verbose_logger.exception( "OpenTelemetry logging error in set_attributes %s", str(e) ) diff --git a/litellm/llms/gemini/files/transformation.py b/litellm/llms/gemini/files/transformation.py index 44e09af892e..fb1e733e433 100644 --- a/litellm/llms/gemini/files/transformation.py +++ b/litellm/llms/gemini/files/transformation.py @@ -4,7 +4,7 @@ Supports writing files to Google AI Studio Files API. For vertex ai, check out the vertex_ai/files/handler.py file. """ import time -from typing import List, Optional +from typing import List, Literal, Optional, cast import httpx from openai.types.file_deleted import FileDeleted @@ -37,12 +37,13 @@ class GoogleAIStudioFilesHandler(GeminiModelInfo, BaseFilesConfig): def validate_environment( self, - api_key: Optional[str], headers: dict, model: str, messages: list, optional_params: dict, litellm_params: dict, + api_key: Optional[str] = None, + api_base: Optional[str] = None, ) -> dict: """ Validate environment and add Gemini API key to headers. @@ -236,7 +237,7 @@ class GoogleAIStudioFilesHandler(GeminiModelInfo, BaseFilesConfig): # Map Gemini state to OpenAI status gemini_state = response_json.get("state", "STATE_UNSPECIFIED") - status = "uploaded" # Default + status: Literal["uploaded", "processed", "error"] = "uploaded" # Default if gemini_state == "ACTIVE": status = "processed" elif gemini_state == "FAILED": @@ -301,7 +302,7 @@ class GoogleAIStudioFilesHandler(GeminiModelInfo, BaseFilesConfig): url = f"{api_base}/v1beta/{file_name}" # Add API key as header (Google AI Studio uses x-goog-api-key header) - params = {} + params: dict = {} return url, params diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index 92fd54e8775..49680e1a1fd 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -69,7 +69,7 @@ try: except ImportError: SEP_986_URL = "https://github.com/modelcontextprotocol/protocol/blob/main/proposals/0001-tool-name-validation.md" - def validate_tool_name(name: str): + def validate_tool_name(name: str): # type: ignore[misc] from pydantic import BaseModel class MockResult(BaseModel): diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.py index 6fd77fab7a7..930443e65b4 100644 --- a/litellm/proxy/common_request_processing.py +++ b/litellm/proxy/common_request_processing.py @@ -751,7 +751,7 @@ class ProxyBaseLLMRequestProcessing: # Do not change this - it should be a constant time fetch - ALWAYS llm_call = await route_request( data=self.data, - route_type=route_type, + route_type=route_type, # type: ignore[arg-type] llm_router=llm_router, user_model=user_model, ) diff --git a/litellm/proxy/common_utils/cache_coordinator.py b/litellm/proxy/common_utils/cache_coordinator.py index 60d7e3947a6..ed74609103a 100644 --- a/litellm/proxy/common_utils/cache_coordinator.py +++ b/litellm/proxy/common_utils/cache_coordinator.py @@ -172,7 +172,7 @@ class EventDrivenCacheCoordinator: Returns the value from cache or from load_fn, or None if load failed or cache was still empty after waiting. """ - value = await self._get_cached(cache_key, cache) + value = await self._get_cached(cache_key, cache) # type: ignore[func-returns-value] if value is not None: self._log_cache_hit(value) return value diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 380e8bddc99..e2450d81f72 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -1544,7 +1544,7 @@ async def _process_single_key_update( await TeamMemberPermissionChecks.can_team_member_execute_key_management_endpoint( user_api_key_dict=user_api_key_dict, route=KeyManagementRoutes.KEY_UPDATE, - prisma_client=prisma_client, + prisma_client=prisma_client, # type: ignore[arg-type] existing_key_row=existing_key_row, user_api_key_cache=user_api_key_cache, ) diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.py index 83d7f3fde4c..adb851e9c5e 100644 --- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py +++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py @@ -60,7 +60,7 @@ if MCP_AVAILABLE: from mcp.shared.tool_name_validation import validate_tool_name # type: ignore except ImportError: - def validate_tool_name(name: str): + def validate_tool_name(name: str): # type: ignore[misc] from pydantic import BaseModel class MockResult(BaseModel): diff --git a/litellm/proxy/openai_files_endpoints/files_endpoints.py b/litellm/proxy/openai_files_endpoints/files_endpoints.py index 9a9f97a3207..a3d3a86ef1a 100644 --- a/litellm/proxy/openai_files_endpoints/files_endpoints.py +++ b/litellm/proxy/openai_files_endpoints/files_endpoints.py @@ -361,7 +361,7 @@ async def create_file( # noqa: PLR0915 expires_after = None form_data = await request.form() litellm_metadata = extract_nested_form_metadata( - form_data=form_data, + form_data=dict(form_data), prefix="litellm_metadata[" ) expires_after_anchor = form_data.get("expires_after[anchor]") diff --git a/litellm/proxy/search_endpoints/endpoints.py b/litellm/proxy/search_endpoints/endpoints.py index c7a3b88c490..fb98c8a0969 100644 --- a/litellm/proxy/search_endpoints/endpoints.py +++ b/litellm/proxy/search_endpoints/endpoints.py @@ -245,8 +245,8 @@ async def list_search_tools( } # Add description if available - if "search_tool_info" in tool and tool["search_tool_info"]: - description = tool["search_tool_info"].get("description") + if "search_tool_info" in tool and tool["search_tool_info"]: # type: ignore[typeddict-item] + description = tool["search_tool_info"].get("description") # type: ignore[typeddict-item] if description: tool_info["description"] = description diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 41abbca755c..74cc87713da 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -1743,7 +1743,7 @@ class LiteLLMCompletionResponsesConfig: and usage.prompt_tokens_details is not None ): prompt_details = usage.prompt_tokens_details - input_details_dict: Dict[str, Optional[int]] = {} + input_details_dict: Dict[str, int] = {} if ( hasattr(prompt_details, "cached_tokens") @@ -1776,7 +1776,7 @@ class LiteLLMCompletionResponsesConfig: and usage.completion_tokens_details is not None ): completion_details = usage.completion_tokens_details - output_details_dict: Dict[str, Optional[int]] = {} + output_details_dict: Dict[str, int] = {} if ( hasattr(completion_details, "reasoning_tokens") and completion_details.reasoning_tokens is not None