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
fix order of _setup_prisma_client
Ishaan Jaff34e58be36dcf
diff --git a/litellm/proxy/db/exception_handler.py b/litellm/proxy/db/exception_handler.pyindex 79229f1e1bb..db73f9e9c93 100644--- a/litellm/proxy/db/exception_handler.py+++ b/litellm/proxy/db/exception_handler.py@@ -18,10 +18,9 @@ class PrismaDBExceptionHandler:"""Returns True if the request should be allowed to proceed despite the DB connection error"""- from litellm.proxy.proxy_server import proxy_config+ from litellm.proxy.proxy_server import general_settings- _general_settings = proxy_config.config- _allow_requests_on_db_unavailable: Union[bool, str] = _general_settings.get(+ _allow_requests_on_db_unavailable: Union[bool, str] = general_settings.get("allow_requests_on_db_unavailable", False)if isinstance(_allow_requests_on_db_unavailable, bool):diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 67d88b9d322..c2044ac1d64 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -454,17 +454,6 @@ async def proxy_startup_event(app: FastAPI):import jsoninit_verbose_loggers()- ### LOAD MASTER KEY ###- # check if master key set in environment - load from there- master_key = get_secret("LITELLM_MASTER_KEY", None) # type: ignore- # check if DATABASE_URL in environment - load from there- if prisma_client is None:- _db_url: Optional[str] = get_secret("DATABASE_URL", None) # type: ignore- prisma_client = await ProxyStartupEvent._setup_prisma_client(- database_url=_db_url,- proxy_logging_obj=proxy_logging_obj,- user_api_key_cache=user_api_key_cache,- )## CHECK PREMIUM USERverbose_proxy_logger.debug("litellm.proxy.proxy_server.py::startup() - CHECKING PREMIUM USER - {}".format(@@ -521,6 +510,18 @@ async def proxy_startup_event(app: FastAPI):if isinstance(worker_config, dict):await initialize(**worker_config)+ ### LOAD MASTER KEY ###+ # check if master key set in environment - load from there+ master_key = get_secret("LITELLM_MASTER_KEY", None) # type: ignore+ # check if DATABASE_URL in environment - load from there+ if prisma_client is None:+ _db_url: Optional[str] = get_secret("DATABASE_URL", None) # type: ignore+ prisma_client = await ProxyStartupEvent._setup_prisma_client(+ database_url=_db_url,+ proxy_logging_obj=proxy_logging_obj,+ user_api_key_cache=user_api_key_cache,+ )+ProxyStartupEvent._initialize_startup_logging(llm_router=llm_router,proxy_logging_obj=proxy_logging_obj,