mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 23:29:21 +00:00
community[patch]: fix a bug that mistakenly handle zip iterator in FAISS.from_embeddings (#16020)
**Description**: `zip` is iterator that will only produce result once, so the previous code will cause the `embeddings` to be an empty list. **Issue**: I could not find a related issue. **Dependencies**: this PR does not introduce or affect dependencies. --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
15c2b4a47e
commit
21e0df937f
@ -986,11 +986,10 @@ class FAISS(VectorStore):
|
|||||||
text_embedding_pairs = zip(texts, text_embeddings)
|
text_embedding_pairs = zip(texts, text_embeddings)
|
||||||
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings)
|
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings)
|
||||||
"""
|
"""
|
||||||
texts = [t[0] for t in text_embeddings]
|
texts, embeddings = zip(*text_embeddings)
|
||||||
embeddings = [t[1] for t in text_embeddings]
|
|
||||||
return cls.__from(
|
return cls.__from(
|
||||||
texts,
|
list(texts),
|
||||||
embeddings,
|
list(embeddings),
|
||||||
embedding,
|
embedding,
|
||||||
metadatas=metadatas,
|
metadatas=metadatas,
|
||||||
ids=ids,
|
ids=ids,
|
||||||
|
Loading…
Reference in New Issue
Block a user