This commit is contained in:
mirodrr2 2025-04-24 06:57:33 +00:00 committed by GitHub
commit 77b8627290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -474,6 +474,9 @@ class LLMCachingHandler:
if litellm.cache is None: if litellm.cache is None:
return None return None
if "litellm_params" not in kwargs:
kwargs["litellm_params"] = {}
new_kwargs = kwargs.copy() new_kwargs = kwargs.copy()
new_kwargs.update( new_kwargs.update(
convert_args_to_kwargs( convert_args_to_kwargs(
@ -502,6 +505,9 @@ class LLMCachingHandler:
cached_result = await litellm.cache.async_get_cache(**new_kwargs) cached_result = await litellm.cache.async_get_cache(**new_kwargs)
else: # for s3 caching. [NOT RECOMMENDED IN PROD - this will slow down responses since boto3 is sync] else: # for s3 caching. [NOT RECOMMENDED IN PROD - this will slow down responses since boto3 is sync]
cached_result = litellm.cache.get_cache(**new_kwargs) cached_result = litellm.cache.get_cache(**new_kwargs)
if cached_result == None and list(kwargs["litellm_params"].keys()) == ["preset_cache_key"]:
del kwargs["litellm_params"]
return cached_result return cached_result
def _convert_cached_result_to_model_response( def _convert_cached_result_to_model_response(