Skip to content

Commit

Permalink
Fixes iter error in FAISS add_embeddings call (#5367)
Browse files Browse the repository at this point in the history
# Remove re-use of iter within add_embeddings causing error

As reported in #5336 there
is an issue currently involving the atempted re-use of an iterator
within the FAISS vectorstore adapter

Fixes # #5336

## Who can review?

Community members can review the PR once tests pass. Tag
maintainers/contributors who might be interested:

  VectorStores / Retrievers / Memory
  - @dev2049
  • Loading branch information
Matt Wells authored May 28, 2023
1 parent b705f26 commit 9a5c9df
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions langchain/vectorstores/faiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ def add_embeddings(
f"adding items, which {self.docstore} does not"
)
# Embed and create the documents.
texts, embeddings = zip(*text_embeddings)

texts = [te[0] for te in text_embeddings]
embeddings = [te[1] for te in text_embeddings]
return self.__add(texts, embeddings, metadatas=metadatas, ids=ids, **kwargs)

def similarity_search_with_score_by_vector(
Expand Down

0 comments on commit 9a5c9df

Please sign in to comment.