(Proxy) add support for DOCS_URL and REDOC_URL (#6806)

* add support for DOCS_URL and REDOC_URL

* document env vars

* add unit tests for docs url and redocs url
This commit is contained in:
Ishaan Jaff 2024-11-19 07:02:12 -08:00 committed by GitHub
parent 7550aba474
commit 1890fde3f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 79 additions and 3 deletions

View file

@ -222,7 +222,9 @@ from litellm.proxy.utils import (
PrismaClient,
ProxyLogging,
_cache_user_row,
_get_docs_url,
_get_projected_spend_over_limit,
_get_redoc_url,
_is_projected_spend_over_limit,
_is_valid_team_configs,
get_error_message_str,
@ -344,7 +346,6 @@ ui_message += "\n\n💸 [```LiteLLM Model Cost Map```](https://models.litellm.ai
custom_swagger_message = "[**Customize Swagger Docs**](https://docs.litellm.ai/docs/proxy/enterprise#swagger-docs---custom-routes--branding)"
### CUSTOM BRANDING [ENTERPRISE FEATURE] ###
_docs_url = None if os.getenv("NO_DOCS", "False") == "True" else "/"
_title = os.getenv("DOCS_TITLE", "LiteLLM API") if premium_user else "LiteLLM API"
_description = (
os.getenv(
@ -355,9 +356,9 @@ _description = (
else f"Proxy Server to call 100+ LLMs in the OpenAI format. {custom_swagger_message}\n\n{ui_message}"
)
app = FastAPI(
docs_url=_docs_url,
docs_url=_get_docs_url(),
redoc_url=_get_redoc_url(),
title=_title,
description=_description,
version=version,