mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 05:08:20 +00:00
fix: kwargs.pop("redis_url") KeyError: 'redis_url' (#3121)
This occurred when redis_url was not passed as a parameter even though a REDIS_URL env variable was present. This occurred for all methods that eventually called any of: (from_texts, drop_index, from_existing_index) - i.e. virtually all methods in the class. This fixes it
This commit is contained in:
parent
dbbc340f25
commit
a63bfb6c9f
@ -273,6 +273,7 @@ class Redis(VectorStore):
|
|||||||
try:
|
try:
|
||||||
# We need to first remove redis_url from kwargs,
|
# We need to first remove redis_url from kwargs,
|
||||||
# otherwise passing it to Redis will result in an error.
|
# otherwise passing it to Redis will result in an error.
|
||||||
|
if "redis_url" in kwargs:
|
||||||
kwargs.pop("redis_url")
|
kwargs.pop("redis_url")
|
||||||
client = redis.from_url(url=redis_url, **kwargs)
|
client = redis.from_url(url=redis_url, **kwargs)
|
||||||
# check if redis has redisearch module installed
|
# check if redis has redisearch module installed
|
||||||
@ -365,6 +366,7 @@ class Redis(VectorStore):
|
|||||||
try:
|
try:
|
||||||
# We need to first remove redis_url from kwargs,
|
# We need to first remove redis_url from kwargs,
|
||||||
# otherwise passing it to Redis will result in an error.
|
# otherwise passing it to Redis will result in an error.
|
||||||
|
if "redis_url" in kwargs:
|
||||||
kwargs.pop("redis_url")
|
kwargs.pop("redis_url")
|
||||||
client = redis.from_url(url=redis_url, **kwargs)
|
client = redis.from_url(url=redis_url, **kwargs)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -400,6 +402,7 @@ class Redis(VectorStore):
|
|||||||
try:
|
try:
|
||||||
# We need to first remove redis_url from kwargs,
|
# We need to first remove redis_url from kwargs,
|
||||||
# otherwise passing it to Redis will result in an error.
|
# otherwise passing it to Redis will result in an error.
|
||||||
|
if "redis_url" in kwargs:
|
||||||
kwargs.pop("redis_url")
|
kwargs.pop("redis_url")
|
||||||
client = redis.from_url(url=redis_url, **kwargs)
|
client = redis.from_url(url=redis_url, **kwargs)
|
||||||
# check if redis has redisearch module installed
|
# check if redis has redisearch module installed
|
||||||
|
Loading…
Reference in New Issue
Block a user