From 616e9a93e08f4f042c492b89545e85e80592ffbe Mon Sep 17 00:00:00 2001 From: Adheeban Manoharan <69910091+iamadhee@users.noreply.github.com> Date: Sat, 20 May 2023 01:32:03 +0530 Subject: [PATCH] Bug fixes and error handling in Redis - Vectorstore (#4932) # Bug fixes in Redis - Vectorstore (Added the version of redis to the error message and removed the cls argument from a classmethod) Co-authored-by: Tyler Hutcherson --- langchain/vectorstores/redis.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/langchain/vectorstores/redis.py b/langchain/vectorstores/redis.py index 4a10b08a..9c4ec0c4 100644 --- a/langchain/vectorstores/redis.py +++ b/langchain/vectorstores/redis.py @@ -56,8 +56,9 @@ def _check_redis_module_exist(client: RedisType, required_modules: List[dict]) - return # otherwise raise error error_message = ( - "You must add the RediSearch (>= 2.4) module from Redis Stack. " - "Please refer to Redis Stack docs: https://redis.io/docs/stack/" + "Redis cannot be used as a vector database without RediSearch >=2.4" + "Please head to https://redis.io/docs/stack/search/quick_start/" + "to know more about installing the RediSearch module within Redis Stack." ) logging.error(error_message) raise ValueError(error_message) @@ -126,7 +127,7 @@ class Redis(VectorStore): except ImportError: raise ValueError( "Could not import redis python package. " - "Please install it with `pip install redis`." + "Please install it with `pip install redis>=4.1.0`." ) self.embedding_function = embedding_function @@ -358,7 +359,7 @@ class Redis(VectorStore): @classmethod def from_texts_return_keys( - cls: Type[Redis], + cls, texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None,