Skip to content

The agent engineering platform.

Handle kwargs in FAISS.load_local() (#6987)

Mike Salvatore3ae11b7582fb
diff --git a/langchain/vectorstores/faiss.py b/langchain/vectorstores/faiss.py
index e92c7eb8ac..bd5eca018e 100644
--- a/langchain/vectorstores/faiss.py
+++ b/langchain/vectorstores/faiss.py
@@ -618,7 +618,11 @@ class FAISS(VectorStore):
@classmethod
def load_local(
- cls, folder_path: str, embeddings: Embeddings, index_name: str = "index"
+ cls,
+ folder_path: str,
+ embeddings: Embeddings,
+ index_name: str = "index",
+ **kwargs: Any,
) -> FAISS:
"""Load FAISS index, docstore, and index_to_docstore_id from disk.
@@ -638,7 +642,9 @@ class FAISS(VectorStore):
# load docstore and index_to_docstore_id
with open(path / "{index_name}.pkl".format(index_name=index_name), "rb") as f:
docstore, index_to_docstore_id = pickle.load(f)
- return cls(embeddings.embed_query, index, docstore, index_to_docstore_id)
+ return cls(
+ embeddings.embed_query, index, docstore, index_to_docstore_id, **kwargs
+ )
def _similarity_search_with_relevance_scores(
self,