We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
VectorDBQA.validate_search_type()
libs/langchain/langchain/chains/retrieval_qa/base.py
1 parent 714f20d commit 3973b34Copy full SHA for 3973b34
libs/langchain/langchain/chains/retrieval_qa/base.py
@@ -1,5 +1,4 @@
1
"""Chain for question-answering against a vector database."""
2
-
3
from __future__ import annotations
4
5
import inspect
@@ -263,11 +262,10 @@ def raise_deprecation(cls, values: Dict) -> Dict:
263
262
@root_validator()
264
def validate_search_type(cls, values: Dict) -> Dict:
265
"""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.")
+ if "search_type" in values:
+ search_type = values["search_type"]
+ if search_type not in ("similarity", "mmr"):
+ raise ValueError(f"search_type of {search_type} not allowed.")
271
return values
272
273
def _get_docs(
0 commit comments