Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,15 +59,16 @@ def get_stock_price(stock: str) -> str:
|
|
| 59 |
except Exception as e:
|
| 60 |
return f"Error fetching price for stock '{stock}': {str(e)}"
|
| 61 |
|
|
|
|
| 62 |
@tool
|
| 63 |
def web_search(query: str) -> dict:
|
| 64 |
-
"""Fetches the result from a web search.
|
| 65 |
-
|
| 66 |
Args:
|
| 67 |
-
|
| 68 |
-
|
| 69 |
Returns:
|
| 70 |
-
A
|
| 71 |
"""
|
| 72 |
try:
|
| 73 |
# Initialize the search tool
|
|
@@ -84,7 +85,7 @@ def web_search(query: str) -> dict:
|
|
| 84 |
|
| 85 |
except Exception as e:
|
| 86 |
return {"query": query, "error": f"Error during search: {str(e)}"}
|
| 87 |
-
|
| 88 |
|
| 89 |
|
| 90 |
final_answer = FinalAnswerTool()
|
|
|
|
| 59 |
except Exception as e:
|
| 60 |
return f"Error fetching price for stock '{stock}': {str(e)}"
|
| 61 |
|
| 62 |
+
|
| 63 |
@tool
|
| 64 |
def web_search(query: str) -> dict:
|
| 65 |
+
"""Fetches the result from a web search using DuckDuckGo.
|
| 66 |
+
|
| 67 |
Args:
|
| 68 |
+
query (str): The search query or question to look up online.
|
| 69 |
+
|
| 70 |
Returns:
|
| 71 |
+
dict: A dictionary containing the query and the top search result or an error message.
|
| 72 |
"""
|
| 73 |
try:
|
| 74 |
# Initialize the search tool
|
|
|
|
| 85 |
|
| 86 |
except Exception as e:
|
| 87 |
return {"query": query, "error": f"Error during search: {str(e)}"}
|
| 88 |
+
|
| 89 |
|
| 90 |
|
| 91 |
final_answer = FinalAnswerTool()
|