From 623b321e757669366a1b1861a6975869c05ecc15 Mon Sep 17 00:00:00 2001 From: c-bata Date: Sat, 22 Jul 2023 00:39:36 +0900 Subject: [PATCH] Fix `allowed_search_types` in `VectorStoreRetriever` (#8064) Unexpectedly changed at https://github.com/hwchase17/langchain/commit/6792a3557dc396804a12ba8892b36a322434c7c6 I guess `allowed_search_types` is unexpectedly changed in https://github.com/hwchase17/langchain/commit/6792a3557dc396804a12ba8892b36a322434c7c6, so that we cannot specify `similarity_score_threshold` here. ```python class VectorStoreRetriever(BaseRetriever): ... allowed_search_types: ClassVar[Collection[str]] = ( "similarity", "similarityatscore_threshold", "mmr", ) @root_validator() def validate_search_type(cls, values: Dict) -> Dict: """Validate search type.""" search_type = values["search_type"] if search_type not in cls.allowed_search_types: raise ValueError(...) if search_type == "similarity_score_threshold": ... # UNREACHABLE CODE ``` VectorStores Maintainers: @rlancemartin @eyurtsev --- langchain/vectorstores/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/vectorstores/base.py b/langchain/vectorstores/base.py index 8e04645222..4911c87a66 100644 --- a/langchain/vectorstores/base.py +++ b/langchain/vectorstores/base.py @@ -465,7 +465,7 @@ class VectorStoreRetriever(BaseRetriever): search_kwargs: dict = Field(default_factory=dict) allowed_search_types: ClassVar[Collection[str]] = ( "similarity", - "similarityatscore_threshold", + "similarity_score_threshold", "mmr", )