From aa72d65c90c23f429661a283c6dd8fb59e8cee83 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 4 Jan 2024 21:49:19 +0530 Subject: [PATCH] fix(utils.py): fix check for if cached response should be returned --- litellm/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 18a3ed824..42c9b4157 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1975,7 +1975,10 @@ def client(original_function): if ( (kwargs.get("caching", None) is None and litellm.cache is not None) or kwargs.get("caching", False) == True - or kwargs.get("cache", {}).get("no-cache", False) != True + or ( + kwargs.get("cache", None) is not None + and kwargs.get("cache", {}).get("no-cache", False) != True + ) ): # allow users to control returning cached responses from the completion function # checking cache print_verbose(f"INSIDE CHECKING CACHE")