mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 17:07:25 +00:00
Harrison/redis id key (#2057)
Co-authored-by: Fabrizio Ruocco <ruoccofabrizio@gmail.com>
This commit is contained in:
parent
71e8eaff2b
commit
880a6a3db5
@ -62,11 +62,13 @@ class Redis(VectorStore):
|
|||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
# `prefix`: Maybe in the future we can let the user choose the index_name.
|
# `prefix`: Maybe in the future we can let the user choose the index_name.
|
||||||
prefix = "doc" # prefix for the document keys
|
prefix = "doc" # prefix for the document keys
|
||||||
|
keys = kwargs.get("keys")
|
||||||
|
|
||||||
ids = []
|
ids = []
|
||||||
# Check if index exists
|
# Check if index exists
|
||||||
for i, text in enumerate(texts):
|
for i, text in enumerate(texts):
|
||||||
key = f"{prefix}:{uuid.uuid4().hex}"
|
_key = keys[i] if keys else uuid.uuid4().hex
|
||||||
|
key = f"{prefix}:{_key}"
|
||||||
metadata = metadatas[i] if metadatas else {}
|
metadata = metadatas[i] if metadatas else {}
|
||||||
self.client.hset(
|
self.client.hset(
|
||||||
key,
|
key,
|
||||||
|
Loading…
Reference in New Issue
Block a user