mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
Handle kwargs in FAISS.load_local() (#6987)
- Description: This allows parameters such as `relevance_score_fn` to be passed to the `FAISS` constructor via the `load_local()` class method. - Tag maintainer: @rlancemartin @eyurtsev
This commit is contained in:
parent
a2f191a322
commit
3ae11b7582
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user