From 965fb6eb2cb643f37b71aba46c48419b62e46d5a Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 25 Mar 2024 22:19:34 -0700 Subject: [PATCH] (fix) cache control logic --- litellm/utils.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 2e16d1d97..dfe2b5576 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2814,17 +2814,16 @@ def client(original_function): ) # if caching is false, don't run this final_embedding_cached_response = None - + cache_controls = kwargs.get("cache", None) if ( - ( - kwargs.get("caching", None) is None - and kwargs.get("cache", None) is None - and litellm.cache is not None - ) - or kwargs.get("caching", False) == True - or ( - kwargs.get("cache", None) is not None - and kwargs.get("cache").get("no-cache", False) != True + kwargs.get("caching", None) is None + and cache_controls is None + and litellm.cache is not None + ) or ( + kwargs.get("caching", False) == True + and ( + cache_controls is not None + and cache_controls.get("no-cache", False) != True ) ): # allow users to control returning cached responses from the completion function # checking cache