From 812419d946daf8e10f07fcd1ea03567ec7f287ad Mon Sep 17 00:00:00 2001 From: Sidchat95 <122575389+Sidchat95@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:31:43 -0500 Subject: [PATCH] =?UTF-8?q?Removing=20score=20threshold=20parameter=20of?= =?UTF-8?q?=20faiss=20=5Fsimilarity=5Fsearch=5Fwith=5Fr=E2=80=A6=20(#8093)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing score threshold parameter of faiss _similarity_search_with_relevance_scores as the thresholding part is implemented in similarity_search_with_relevance_scores method which calls this method. As this method is supposed to be a private method of faiss.py this will never receive the score threshold parameter as it is popped in the super method similarity_search_with_relevance_scores. @baskaryan @hwchase17 --- libs/langchain/langchain/vectorstores/faiss.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libs/langchain/langchain/vectorstores/faiss.py b/libs/langchain/langchain/vectorstores/faiss.py index 0e29daf01b..a5f1ba4b61 100644 --- a/libs/langchain/langchain/vectorstores/faiss.py +++ b/libs/langchain/langchain/vectorstores/faiss.py @@ -727,7 +727,6 @@ class FAISS(VectorStore): """Return docs and their similarity scores on a scale from 0 to 1.""" # Pop score threshold so that only relevancy scores, not raw scores, are # filtered. - score_threshold = kwargs.pop("score_threshold", None) relevance_score_fn = self._select_relevance_score_fn() if relevance_score_fn is None: raise ValueError( @@ -744,10 +743,4 @@ class FAISS(VectorStore): docs_and_rel_scores = [ (doc, relevance_score_fn(score)) for doc, score in docs_and_scores ] - if score_threshold is not None: - docs_and_rel_scores = [ - (doc, similarity) - for doc, similarity in docs_and_rel_scores - if similarity >= score_threshold - ] return docs_and_rel_scores