Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In add_texts use documents ids if keys are not provided #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libs/redis/langchain_redis/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def add_texts(
texts_list = list(texts)
# Embed the documents in bulk
embeddings = self._embeddings.embed_documents(texts_list)

keys_or_ids = keys if keys else kwargs.get("ids")
datas = [
{
self.config.content_field: text,
Expand All @@ -445,9 +445,9 @@ def add_texts(

result = (
self._index.load(
datas, keys=[f"{self.config.key_prefix}:{key}" for key in keys]
datas, keys=[f"{self.config.key_prefix}:{key}" for key in keys_or_ids]
)
if keys
if keys_or_ids
else self._index.load(datas)
)

Expand Down