Fixes iter error in FAISS add_embeddings call (#5367)

# Remove re-use of iter within add_embeddings causing error

As reported in https://github.com/hwchase17/langchain/issues/5336 there
is an issue currently involving the atempted re-use of an iterator
within the FAISS vectorstore adapter

Fixes # https://github.com/hwchase17/langchain/issues/5336

## Who can review?

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

  VectorStores / Retrievers / Memory
  - @dev2049
searx_updates
Matt Wells 12 months ago committed by GitHub
parent b705f260f4
commit 9a5c9df809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -175,9 +175,8 @@ class FAISS(VectorStore):
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(

Loading…
Cancel
Save