Spaces:
Sleeping
Sleeping
Fixed functioncalls in search_tool
Browse files
app.py
CHANGED
|
@@ -62,28 +62,23 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 62 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 63 |
|
| 64 |
@tool
|
| 65 |
-
def search_tool(query: str) -> str:
|
| 66 |
"""
|
| 67 |
-
Search the web using DuckDuckGo.
|
| 68 |
-
|
| 69 |
Args:
|
| 70 |
query: The search query string
|
| 71 |
"""
|
| 72 |
try:
|
| 73 |
if not query or not query.strip():
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
results = search.
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
return "No results found."
|
| 82 |
-
|
| 83 |
-
return f" The following results have been found '{results}'."
|
| 84 |
-
|
| 85 |
except Exception as e:
|
| 86 |
-
return f"Error during
|
| 87 |
|
| 88 |
final_answer = FinalAnswerTool()
|
| 89 |
|
|
|
|
| 62 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 63 |
|
| 64 |
@tool
|
| 65 |
+
def search_tool(query: str) -> str:
|
| 66 |
"""
|
| 67 |
+
Search the web using DuckDuckGo.
|
|
|
|
| 68 |
Args:
|
| 69 |
query: The search query string
|
| 70 |
"""
|
| 71 |
try:
|
| 72 |
if not query or not query.strip():
|
| 73 |
+
return "Query is empty"
|
| 74 |
+
|
| 75 |
+
search = DuckDuckGoSearchTool()
|
| 76 |
+
|
| 77 |
+
results = search.forward(query)
|
| 78 |
+
|
| 79 |
+
return f"The following results have been found: '{results}'"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
except Exception as e:
|
| 81 |
+
return f"Error during search: {e}"
|
| 82 |
|
| 83 |
final_answer = FinalAnswerTool()
|
| 84 |
|