diff --git a/libs/langchain/langchain/retrievers/web_research.py b/libs/langchain/langchain/retrievers/web_research.py index e8ebfd7b43..478005cb35 100644 --- a/libs/langchain/langchain/retrievers/web_research.py +++ b/libs/langchain/langchain/retrievers/web_research.py @@ -179,15 +179,16 @@ class WebResearchRetriever(BaseRetriever): logger.info(f"Questions for Google Search: {questions}") # Get urls - logger.info("Searching for relevat urls ...") + logger.info("Searching for relevant urls...") urls_to_look = [] for query in questions: # Google search search_results = self.search_tool(query, self.num_search_results) - logger.info("Searching for relevat urls ...") + logger.info("Searching for relevant urls...") logger.info(f"Search results: {search_results}") for res in search_results: - urls_to_look.append(res["link"]) + if res.get("link", None): + urls_to_look.append(res["link"]) # Relevant urls urls = set(urls_to_look)