Skip to content

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]

add doc string for /chat/completions swagger

Ishaan Jafff6e80b003105
diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml
index 5d8e221442b..65c7f70525c 100644
--- a/litellm/proxy/proxy_config.yaml
+++ b/litellm/proxy/proxy_config.yaml
@@ -1,13 +1,18 @@
model_list:
- - model_name: multimodalembedding@001
+ - model_name: gpt-4
litellm_params:
+ model: openai/fake
+ api_key: fake-key
+ api_base: https://exampleopenaiendpoint-production.up.railway.app/
- model: vertex_ai/multimodalembedding@001
- vertex_project: "adroit-crow-413218"
- vertex_location: "us-central1"
- vertex_credentials: adroit-crow-413218-a956eef1a2a8.json
-
-default_vertex_config:
- vertex_project: "adroit-crow-413218"
- vertex_location: "us-central1"
- vertex_credentials: adroit-crow-413218-a956eef1a2a8.json
+guardrails:
+ - guardrail_name: "lakera-pre-guard"
+ litellm_params:
+ guardrail: lakera # supported values: "aporia", "bedrock", "lakera"
+ mode: "during_call"
+ api_key: os.environ/LAKERA_API_KEY
+ api_base: os.environ/LAKERA_API_BASE
+ category_thresholds:
+ prompt_injection: 0.1
+ jailbreak: 0.1
+
\ No newline at end of file
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index d07f63f53a6..dbe2c97ec08 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -3014,6 +3014,29 @@ async def chat_completion(
model: Optional[str] = None,
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
+ """
+
+ Follows the exact same API spec as `OpenAI's Chat API https://platform.openai.com/docs/api-reference/chat`
+
+ ```bash
+ curl -X POST http://localhost:4000/v1/chat/completions \
+
+ -H "Content-Type: application/json" \
+
+ -H "Authorization: Bearer sk-1234" \
+
+ -d '{
+ "model": "gpt-4o",
+ "messages": [
+ {
+ "role": "user",
+ "content": "Hello!"
+ }
+ ]
+ }'
+ ```
+
+ """
global general_settings, user_debug, proxy_logging_obj, llm_model_list
data = {}