Skip to content

Commit

Permalink
Bug fixes and error handling in Redis - Vectorstore (#4932)
Browse files Browse the repository at this point in the history
# 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 <tyler.hutcherson@redis.com>
  • Loading branch information
iamadhee and tylerhutcherson authored May 19, 2023
1 parent a87a252 commit 616e9a9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions langchain/vectorstores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -126,7 +127,7 @@ def __init__(
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
Expand Down Expand Up @@ -358,7 +359,7 @@ def _similarity_search_with_relevance_scores(

@classmethod
def from_texts_return_keys(
cls: Type[Redis],
cls,
texts: List[str],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
Expand Down

0 comments on commit 616e9a9

Please sign in to comment.