mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(minor latency fixes / proxy) - use verbose_proxy_logger.debug() instead of litellm.print_verbose (#7664)
* minor latency fixes * fix code quality
This commit is contained in:
parent
768275f3ce
commit
b9dbc70a8e
3 changed files with 8 additions and 14 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue