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]

(minor latency fixes / proxy) - use verbose_proxy_logger.debug() instead of litellm.print_verbose (#7664)

Ishaan Jaff6df8faf15f23
diff --git a/litellm/proxy/hooks/cache_control_check.py b/litellm/proxy/hooks/cache_control_check.py
index 4cf1668c220..6e3fbf84fab 100644
--- a/litellm/proxy/hooks/cache_control_check.py
+++ b/litellm/proxy/hooks/cache_control_check.py
@@ -4,8 +4,8 @@
from fastapi import HTTPException
-import litellm
from litellm import verbose_logger
+from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache
from litellm.integrations.custom_logger import CustomLogger
from litellm.proxy._types import UserAPIKeyAuth
@@ -16,10 +16,6 @@ class _PROXY_CacheControlCheck(CustomLogger):
def __init__(self):
pass
- def print_verbose(self, print_statement):
- if litellm.set_verbose is True:
- print(print_statement) # noqa
-
async def async_pre_call_hook(
self,
user_api_key_dict: UserAPIKeyAuth,
@@ -28,7 +24,7 @@ class _PROXY_CacheControlCheck(CustomLogger):
call_type: str,
):
try:
- self.print_verbose("Inside Cache Control Check Pre-Call Hook")
+ verbose_proxy_logger.debug("Inside Cache Control Check Pre-Call Hook")
allowed_cache_controls = user_api_key_dict.allowed_cache_controls
if data.get("cache", None) is None:
diff --git a/litellm/proxy/hooks/max_budget_limiter.py b/litellm/proxy/hooks/max_budget_limiter.py
index 9697efff7b8..4b59f603d3e 100644
--- a/litellm/proxy/hooks/max_budget_limiter.py
+++ b/litellm/proxy/hooks/max_budget_limiter.py
@@ -1,7 +1,7 @@
from fastapi import HTTPException
-import litellm
from litellm import verbose_logger
+from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache
from litellm.integrations.custom_logger import CustomLogger
from litellm.proxy._types import UserAPIKeyAuth
@@ -12,10 +12,6 @@ class _PROXY_MaxBudgetLimiter(CustomLogger):
def __init__(self):
pass
- def print_verbose(self, print_statement):
- if litellm.set_verbose is True:
- print(print_statement) # noqa
-
async def async_pre_call_hook(
self,
user_api_key_dict: UserAPIKeyAuth,
@@ -24,7 +20,7 @@ class _PROXY_MaxBudgetLimiter(CustomLogger):
call_type: str,
):
try:
- self.print_verbose("Inside Max Budget Limiter Pre-Call Hook")
+ verbose_proxy_logger.debug("Inside Max Budget Limiter Pre-Call Hook")
cache_key = f"{user_api_key_dict.user_id}_user_api_key_user_id"
user_row = await cache.async_get_cache(
cache_key, parent_otel_span=user_api_key_dict.parent_otel_span
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index fc68830e872..31ea9c80b73 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -472,8 +472,8 @@ class ProxyLogging:
2. /embeddings
3. /image/generation
"""
- print_verbose("Inside Proxy Logging Pre-call hook!")
- ### ALERTING ###
+ verbose_proxy_logger.debug("Inside Proxy Logging Pre-call hook!")
+ ## ALERTING ###
asyncio.create_task(
self.slack_alerting_instance.response_taking_too_long(request_data=data)
)
@@ -517,6 +517,8 @@ class ProxyLogging:
_callback is not None
and isinstance(_callback, CustomLogger)
and "async_pre_call_hook" in vars(_callback.__class__)
+ and _callback.__class__.async_pre_call_hook
+ != CustomLogger.async_pre_call_hook
):
response = await _callback.async_pre_call_hook(
user_api_key_dict=user_api_key_dict,