Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,19 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
# Web search tool using DuckDuckGo
|
| 22 |
+
@tool
|
| 23 |
+
def web_search(query: str) -> list:
|
| 24 |
+
"""A tool that performs a web search using DuckDuckGo and returns relevant results.
|
| 25 |
+
Args:
|
| 26 |
+
query: The search term or question to look up.
|
| 27 |
+
Returns:
|
| 28 |
+
A list of search results containing URLs and descriptions.
|
| 29 |
+
"""
|
| 30 |
+
search_tool = DuckDuckGoSearchTool()
|
| 31 |
+
results = search_tool.run(query)
|
| 32 |
+
return results
|
| 33 |
+
|
| 34 |
@tool
|
| 35 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 36 |
"""A tool that fetches the current local time in a specified timezone.
|