def search_duckduckgo(query:str)-> str: #it's import to specify the return type """#A tool that fetches the air quality in a specified ( region) postal code Args: query: A string asking the question """ try: results = ddg(query, max_results = 1) answer = results[0]["body"] if results else "No result found." return f"Top search result or '{query}': {answer}" except Exception as e: return f"Failed to search DuckDuckGo for '{query}': {str(e)}"

#430

def search_duckduckgo(query:str)-> str: #it's import to specify the return type
"""#A tool that fetches the air quality in a specified ( region) postal code
Args:
query: A string asking the question

"""
try: 
    results = ddg(query, max_results = 1)
    answer = results[0]["body"] if results else "No result found."
    
return f"Top search result or '{query}': {answer}"

except Exception as e:
return f"Failed to search DuckDuckGo for '{query}': {str(e)}"

athiraanil831 changed pull request status to closed

Sign up or log in to comment