refactor: clean up _invoke_callback_setup_proxy

- Remove redundant hasattr check (setup_proxy is defined on base class)
- Remove inline import (CustomLogger already imported at module level)
- Add note about call timing (before DB init) in docstring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaeyeon Kim 2026-03-05 22:46:44 +09:00
parent 1c3a3bebb7
commit 725c5648aa

View file

@ -762,11 +762,12 @@ def _invoke_callback_setup_proxy(app: FastAPI) -> None:
This gives callbacks an opportunity to interact with the FastAPI app
during startup, e.g., to add middleware or mount additional routes.
"""
from litellm.integrations.custom_logger import CustomLogger
Note: Called after config load but before DB initialization, so callbacks
should not depend on prisma_client being available.
"""
for callback in litellm.callbacks:
if isinstance(callback, CustomLogger) and hasattr(callback, "setup_proxy"):
if isinstance(callback, CustomLogger):
try:
callback.setup_proxy(app)
except Exception as e: