forked from phoenix/litellm-mirror
(fix) cache control logic
This commit is contained in:
parent
ef93fcaa8e
commit
965fb6eb2c
1 changed files with 9 additions and 10 deletions
|
@ -2814,17 +2814,16 @@ def client(original_function):
|
||||||
)
|
)
|
||||||
# if caching is false, don't run this
|
# if caching is false, don't run this
|
||||||
final_embedding_cached_response = None
|
final_embedding_cached_response = None
|
||||||
|
cache_controls = kwargs.get("cache", None)
|
||||||
if (
|
if (
|
||||||
(
|
|
||||||
kwargs.get("caching", None) is None
|
kwargs.get("caching", None) is None
|
||||||
and kwargs.get("cache", None) is None
|
and cache_controls is None
|
||||||
and litellm.cache is not None
|
and litellm.cache is not None
|
||||||
)
|
) or (
|
||||||
or kwargs.get("caching", False) == True
|
kwargs.get("caching", False) == True
|
||||||
or (
|
and (
|
||||||
kwargs.get("cache", None) is not None
|
cache_controls is not None
|
||||||
and kwargs.get("cache").get("no-cache", False) != True
|
and cache_controls.get("no-cache", False) != True
|
||||||
)
|
)
|
||||||
): # allow users to control returning cached responses from the completion function
|
): # allow users to control returning cached responses from the completion function
|
||||||
# checking cache
|
# checking cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue