The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Fix NoneType has no len() in DDG tool (#3334)
Dianliang2330cf934ce7d81
diff --git a/langchain/utilities/duckduckgo_search.py b/langchain/utilities/duckduckgo_search.pyindex 30e8a66eb0..547847b904 100644--- a/langchain/utilities/duckduckgo_search.py+++ b/langchain/utilities/duckduckgo_search.py@@ -49,7 +49,7 @@ class DuckDuckGoSearchAPIWrapper(BaseModel):time=self.time,max_results=self.max_results,)- if len(results) == 0:+ if results is None or len(results) == 0:return "No good DuckDuckGo Search Result was found"snippets = [result["body"] for result in results]return " ".join(snippets)@@ -77,7 +77,7 @@ class DuckDuckGoSearchAPIWrapper(BaseModel):max_results=num_results,)- if len(results) == 0:+ if results is None or len(results) == 0:return [{"Result": "No good DuckDuckGo Search Result was found"}]def to_metadata(result: Dict) -> Dict: