Skip to content

Commit 59688e1

Browse files
authored
Merge pull request #50 from codeflash-ai/revert-49-codeflash/optimize-VectorDBQA.validate_search_type-2024-03-14T01.50.29
Revert "⚡️ Speed up `VectorDBQA.validate_search_type()` by 7% in `libs/langchain/langchain/chains/retrieval_qa/base.py`"
2 parents 714f20d + 3973b34 commit 59688e1

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)