File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1010from langchain .text_splitter import RecursiveCharacterTextSplitter , TextSplitter
1111from langchain .chains import LLMChain
1212from langchain .retrievers .multi_query import MultiQueryRetriever
13+ from duckduckgo_search .exceptions import DuckDuckGoSearchException
1314
1415from .prompt import MULTI_QUERY_PROMPT_TEMPLATE
1516from .utils import get_model
@@ -36,7 +37,10 @@ def _get_relevant_documents(
3637 run_manager : CallbackManagerForRetrieverRun ,
3738 ) -> List [Document ]:
3839
39- results = self .search .results (query , self .num_search_results )
40+ try :
41+ results = self .search .results (query , self .num_search_results )
42+ except DuckDuckGoSearchException :
43+ results = []
4044
4145 docs = []
4246 for res in results :
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ langchain==0.0.319
22openai == 0.28.1
33chromadb == 0.4.14
44tiktoken == 0.5.1
5- duckduckgo-search == 4.1.0
5+ duckduckgo-search == 4.1.1
66gradio == 3.50.0
You can’t perform that action at this time.
0 commit comments