Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,13 +19,14 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
-
def web_search(
|
| 23 |
-
"""
|
| 24 |
Args:
|
| 25 |
-
search: A string containing the search query
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
-
|
|
|
|
| 29 |
return f"Search results: {search_results}"
|
| 30 |
except Exception as e:
|
| 31 |
return f"Error fetching search results: {str(e)}"
|
|
@@ -67,7 +68,10 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 67 |
|
| 68 |
agent = CodeAgent(
|
| 69 |
model=model,
|
| 70 |
-
tools=[
|
|
|
|
|
|
|
|
|
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
+
def web_search(query: str) -> str:
|
| 23 |
+
"""Searches DuckDuckGo for a given query.
|
| 24 |
Args:
|
| 25 |
+
search: A string containing the search query.
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
+
search_tool = DuckDuckGoSearchTool()
|
| 29 |
+
search_results = search_tool(query)
|
| 30 |
return f"Search results: {search_results}"
|
| 31 |
except Exception as e:
|
| 32 |
return f"Error fetching search results: {str(e)}"
|
|
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
+
tools=[web_search,
|
| 72 |
+
get_current_time_in_timezone,
|
| 73 |
+
image_generation_tool,
|
| 74 |
+
final_answer], ## add your tools here (don't remove final answer)
|
| 75 |
max_steps=6,
|
| 76 |
verbosity_level=1,
|
| 77 |
grammar=None,
|