Skip to content

The agent engineering platform.

community[patch]: fix a bug that mistakenly handle zip iterator in FAISS.from_embeddings (#16020)

Neo Zhao21e0df937f57
diff --git a/libs/community/langchain_community/vectorstores/faiss.py b/libs/community/langchain_community/vectorstores/faiss.py
index 4e7e5619e1..8ca609b725 100644
--- a/libs/community/langchain_community/vectorstores/faiss.py
+++ b/libs/community/langchain_community/vectorstores/faiss.py
@@ -986,11 +986,10 @@ class FAISS(VectorStore):
text_embedding_pairs = zip(texts, text_embeddings)
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings)
"""
- texts = [t[0] for t in text_embeddings]
- embeddings = [t[1] for t in text_embeddings]
+ texts, embeddings = zip(*text_embeddings)
return cls.__from(
- texts,
- embeddings,
+ list(texts),
+ list(embeddings),
embedding,
metadatas=metadatas,
ids=ids,