fix(caching.py): fix error logging

This commit is contained in:
Krrish Dholakia 2024-04-18 17:21:10 -07:00
parent 0afb5d6573
commit f65005f273
2 changed files with 8 additions and 3 deletions

View file

@ -478,7 +478,9 @@ class RedisCache(BaseCache):
_duration = end_time - start_time _duration = end_time - start_time
asyncio.create_task( asyncio.create_task(
self.service_logger_obj.async_service_success_hook( self.service_logger_obj.async_service_success_hook(
service=ServiceTypes.REDIS, duration=_duration service=ServiceTypes.REDIS,
duration=_duration,
call_type="async_get_cache",
) )
) )
return response return response
@ -488,7 +490,10 @@ class RedisCache(BaseCache):
_duration = end_time - start_time _duration = end_time - start_time
asyncio.create_task( asyncio.create_task(
self.service_logger_obj.async_service_failure_hook( self.service_logger_obj.async_service_failure_hook(
service=ServiceTypes.REDIS, duration=_duration, error=e service=ServiceTypes.REDIS,
duration=_duration,
error=e,
call_type="async_get_cache",
) )
) )
# NON blocking - notify users Redis is throwing an exception # NON blocking - notify users Redis is throwing an exception

View file

@ -412,7 +412,7 @@ async def test_cost_tracking_with_caching():
""" """
from litellm import Cache from litellm import Cache
litellm.set_verbose = False litellm.set_verbose = True
litellm.cache = Cache( litellm.cache = Cache(
type="redis", type="redis",
host=os.environ["REDIS_HOST"], host=os.environ["REDIS_HOST"],