Skip to content

Commit 3973b34

Browse files
authored
Revert "⚡️ Speed up VectorDBQA.validate_search_type() by 7% in libs/langchain/langchain/chains/retrieval_qa/base.py"
1 parent 714f20d commit 3973b34

File tree

1 file changed

+4
-6
lines changed
  • libs/langchain/langchain/chains/retrieval_qa

1 file changed

+4
-6
lines changed

libs/langchain/langchain/chains/retrieval_qa/base.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Chain for question-answering against a vector database."""
2-
32
from __future__ import annotations
43

54
import inspect
@@ -263,11 +262,10 @@ def raise_deprecation(cls, values: Dict) -> Dict:
263262
@root_validator()
264263
def validate_search_type(cls, values: Dict) -> Dict:
265264
"""Validate search type."""
266-
if "search_type" in values and values["search_type"] not in (
267-
"similarity",
268-
"mmr",
269-
):
270-
raise ValueError(f"search_type of {values['search_type']} not allowed.")
265+
if "search_type" in values:
266+
search_type = values["search_type"]
267+
if search_type not in ("similarity", "mmr"):
268+
raise ValueError(f"search_type of {search_type} not allowed.")
271269
return values
272270

273271
def _get_docs(

0 commit comments

Comments
 (0)