mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
Merge 4cc319502d
into b82af5b826
This commit is contained in:
commit
77b8627290
1 changed files with 7 additions and 1 deletions
|
@ -473,7 +473,10 @@ 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(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue