Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
@tool
|
| 37 |
+
def duck_duck_go_search(query: str) -> str:
|
| 38 |
+
"""A tool that uses the DuckDuckGoSearchTool to search the web with DuckDuckGo.
|
| 39 |
+
Args:
|
| 40 |
+
query: A string representing the user's search query (e.g., 'latest AI research trends').
|
| 41 |
+
"""
|
| 42 |
+
try:
|
| 43 |
+
search_tool = DuckDuckGoSearchTool()
|
| 44 |
+
results = search_tool.run(query)
|
| 45 |
+
return f"Search results for '{query}':\n{results}"
|
| 46 |
+
except Exception as e:
|
| 47 |
+
return f"Error performing search with DuckDuckGo: {str(e)}"
|
| 48 |
+
|
| 49 |
+
|
| 50 |
|
| 51 |
final_answer = FinalAnswerTool()
|
| 52 |
|