diff --git a/litellm/tests/test_cache.py b/litellm/tests/test_cache.py index db3aad6238..40be3b9a53 100644 --- a/litellm/tests/test_cache.py +++ b/litellm/tests/test_cache.py @@ -41,3 +41,4 @@ def test_completion_gpt(): pytest.fail(f"Error occurred: {e}") +litellm.cache = False # rest to False for the next test \ No newline at end of file diff --git a/litellm/utils.py b/litellm/utils.py index 58f5347b4a..f3ff858bc1 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -722,6 +722,8 @@ def message_to_user_question(messages): def add_cache(messages, model_response): global cache_collection + if cache_collection == None: + make_collection() user_question = message_to_user_question(messages) cache_collection.add( documents=[user_question],