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 search_with_ducky(question: str) -> str:
|
| 38 |
+
"""A tool that performs web search using DuckDuckGo browser
|
| 39 |
+
Args:
|
| 40 |
+
question: A string representing a valid user question.
|
| 41 |
+
"""
|
| 42 |
+
try:
|
| 43 |
+
# Create search object
|
| 44 |
+
search_tool = DuckDuckGoSearchTool()
|
| 45 |
+
# search the web with DuckDuck
|
| 46 |
+
answer = search_tool(question)
|
| 47 |
+
return answer
|
| 48 |
+
except Exception as e:
|
| 49 |
+
return f"Error searching the web for '{question}': {str(e)}"
|
| 50 |
|
| 51 |
final_answer = FinalAnswerTool()
|
| 52 |
|