From a1b64832a7521b42caa65569186b78519d863bd7 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Thu, 10 Aug 2023 15:14:58 -0700 Subject: [PATCH] with caching --- litellm/utils.py | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 6937d33cf..5b4963567 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -724,29 +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) + # 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()) + # print("in add cache, peek()", cache_collection.peek()) return def get_cache(messages): - print("in get cache") + # print("in get cache") try: global cache_collection if cache_collection == None: make_collection() - print("cache collection", cache_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) + # print("query cache result", results) distance = results['distances'][0][0] sim = (1 - distance) if sim >= litellm.cache_similarity_threshold: @@ -757,5 +757,5 @@ def get_cache(messages): # no hit return None except Exception as e: - print("error in get cache", e) + # print("error in get cache", e) return None diff --git a/pyproject.toml b/pyproject.toml index 1878c21ce..b722dd397 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm" -version = "0.1.373" +version = "0.1.374" description = "Library to easily interface with LLM API providers" authors = ["BerriAI"] license = "MIT License"