feat: litellm opt-out support

This commit is contained in:
Timothy J. Baek 2024-04-26 17:19:50 -04:00
parent dbf7b15539
commit b22415d456

View file

@ -47,6 +47,7 @@ from config import (
FRONTEND_BUILD_DIR, FRONTEND_BUILD_DIR,
CACHE_DIR, CACHE_DIR,
STATIC_DIR, STATIC_DIR,
ENABLE_LITELLM,
ENABLE_MODEL_FILTER, ENABLE_MODEL_FILTER,
MODEL_FILTER_LIST, MODEL_FILTER_LIST,
GLOBAL_LOG_LEVEL, GLOBAL_LOG_LEVEL,
@ -179,6 +180,7 @@ async def check_url(request: Request, call_next):
@app.on_event("startup") @app.on_event("startup")
async def on_startup(): async def on_startup():
if ENABLE_LITELLM:
asyncio.create_task(start_litellm_background()) asyncio.create_task(start_litellm_background())
@ -329,4 +331,5 @@ app.mount(
@app.on_event("shutdown") @app.on_event("shutdown")
async def shutdown_event(): async def shutdown_event():
if ENABLE_LITELLM:
await shutdown_litellm_background() await shutdown_litellm_background()