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
Add the option to specify a schema in the postgres DB, also modify docs (#5640)
steffen-sbtde9a39e7c68e
diff --git a/docs/my-website/docs/proxy/deploy.md b/docs/my-website/docs/proxy/deploy.mdindex a3a2f0dc465..1f8d3ec2c00 100644--- a/docs/my-website/docs/proxy/deploy.md+++ b/docs/my-website/docs/proxy/deploy.md@@ -265,12 +265,12 @@ LiteLLM is compatible with several SDKs - including OpenAI SDK, Anthropic SDK, M## Options to deploy LiteLLM-| Docs | When to Use |-| --- | --- |-| [Quick Start](#quick-start) | call 100+ LLMs + Load Balancing |-| [Deploy with Database](#deploy-with-database) | + use Virtual Keys + Track Spend (Note: When deploying with a database providing a `DATABASE_URL` and `LITELLM_MASTER_KEY` are required in your env ) |-| [LiteLLM container + Redis](#litellm-container--redis) | + load balance across multiple litellm containers |-| [LiteLLM Database container + PostgresDB + Redis](#litellm-database-container--postgresdb--redis) | + use Virtual Keys + Track Spend + load balance across multiple litellm containers |+| Docs | When to Use |+| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |+| [Quick Start](#quick-start) | call 100+ LLMs + Load Balancing |+| [Deploy with Database](#deploy-with-database) | + use Virtual Keys + Track Spend (Note: When deploying with a database providing a `DATABASE_URL` and `LITELLM_MASTER_KEY` are required in your env ) |+| [LiteLLM container + Redis](#litellm-container--redis) | + load balance across multiple litellm containers |+| [LiteLLM Database container + PostgresDB + Redis](#litellm-database-container--postgresdb--redis) | + use Virtual Keys + Track Spend + load balance across multiple litellm containers |## Deploy with Database### Docker, Kubernetes, Helm Chart@@ -943,6 +943,7 @@ export DATABASE_USER="db-user"export DATABASE_PORT="5432"export DATABASE_HOST="database-1-instance-1.cs1ksmwz2xt3.us-west-2.rds.amazonaws.com"export DATABASE_NAME="database-1-instance-1"+export DATABASE_SCHEMA="schema-name" # skip to use the default "public" schema```3. Run proxy with iam+rdsdiff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.pyindex b9eddc25726..7da9fe479ed 100644--- a/litellm/proxy/proxy_cli.py+++ b/litellm/proxy/proxy_cli.py@@ -464,6 +464,7 @@ def run_server(db_port = os.getenv("DATABASE_PORT")db_user = os.getenv("DATABASE_USER")db_name = os.getenv("DATABASE_NAME")+ db_schema = os.getenv("DATABASE_SCHEMA")token = generate_iam_auth_token(db_host=db_host, db_port=db_port, db_user=db_user@@ -471,6 +472,9 @@ def run_server(# print(f"token: {token}")_db_url = f"postgresql://{db_user}:{token}@{db_host}:{db_port}/{db_name}"+ if db_schema:+ _db_url += f"?schema={db_schema}"+os.environ["DATABASE_URL"] = _db_url### DECRYPT ENV VAR ###