diff --git a/.circleci/config.yml b/.circleci/config.yml index 74c4b4893..b7f28b69c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,7 +16,7 @@ jobs: pip install infisical pip install pytest pip install openai[datalib] - pip install chromadb + pip install -Uq chromadb # Run pytest and generate JUnit XML report - run: diff --git a/litellm/utils.py b/litellm/utils.py index f3ff858bc..6937d33cf 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -724,24 +724,29 @@ def add_cache(messages, model_response): global cache_collection if cache_collection == None: make_collection() + print("cache collection in add cache", cache_collection) user_question = message_to_user_question(messages) cache_collection.add( documents=[user_question], metadatas=[{"model_response": str(model_response)}], ids = [ str(uuid.uuid4())] ) + print("in add cache, peek()", cache_collection.peek()) return def get_cache(messages): + print("in get cache") try: global cache_collection if cache_collection == None: make_collection() + print("cache collection", cache_collection) user_question = message_to_user_question(messages) results = cache_collection.query( query_texts=[user_question], n_results=1 ) + print("query cache result", results) distance = results['distances'][0][0] sim = (1 - distance) if sim >= litellm.cache_similarity_threshold: @@ -751,5 +756,6 @@ def get_cache(messages): else: # no hit return None - except: + except Exception as e: + print("error in get cache", e) return None