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]

Merge branch 'litellm_yj_may1' into codex/vector-store-tenant-guard

yuneng-jiang38fae659b58c
diff --cc litellm/proxy/_lazy_openapi_snapshot.py
index 9c317a5365b,6ef8e51644b..f9519cc17c1
--- a/litellm/proxy/_lazy_openapi_snapshot.py
+++ b/litellm/proxy/_lazy_openapi_snapshot.py
@@@ -10,19 -10,10 +10,19 @@@ any drift as a neutral check
import json
import sys
from pathlib import Path
- from typing import Dict, Optional
+ from typing import Dict, Optional, Set
SNAPSHOT_FILE = Path(__file__).parent / "_lazy_openapi_snapshot.json"
-HTTP_METHODS = {"delete", "get", "head", "options", "patch", "post", "put"}
+HTTP_METHOD_SUFFIXES = {
+ "delete",
+ "get",
+ "head",
+ "options",
+ "patch",
+ "post",
+ "put",
+ "trace",
+}
def load_snapshot() -> Optional[Dict[str, Dict]]:
@@@ -62,21 -87,16 +96,24 @@@ def generate_snapshot() -> Dict[str, Di
if not feat_routes:
continue
full = get_openapi(title=app.title, version=app.version, routes=feat_routes)
+ paths = full.get("paths", {})
+ _normalize_operation_ids(paths)
# Group all of a feature's routes under one tag.
- for path_ops in paths.values():
- for op in path_ops.values():
+ for path_ops in full.get("paths", {}).values():
+ for method, op in path_ops.items():
if isinstance(op, dict):
+ operation_id = op.get("operationId")
+ if isinstance(operation_id, str):
+ for suffix in HTTP_METHOD_SUFFIXES:
+ if operation_id.endswith(f"_{suffix}"):
+ op["operationId"] = (
+ operation_id[: -len(suffix)] + method
+ )
+ break
op["tags"] = [feat.name]
+ full = ensure_unique_openapi_operation_ids(full, used_operation_ids)
fragments[feat.name] = {
- "paths": full.get("paths", {}),
+ "paths": paths,
"components": {"schemas": full.get("components", {}).get("schemas", {})},
}
return fragments