Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,18 @@ 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.
|
|
@@ -55,7 +67,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
|
| 22 |
+
@tool
|
| 23 |
+
|
| 24 |
+
def search_query(max_results:int,query:str)->str:
|
| 25 |
+
""" A tool that given a query searchs the web and returns a result or number of results depending on the user argument
|
| 26 |
+
Args:
|
| 27 |
+
max_results: the number of results the user wants returned
|
| 28 |
+
query: the question the user asks
|
| 29 |
+
"""
|
| 30 |
+
search=DuckDuckGoSearchTool(max_results=max_results)
|
| 31 |
+
|
| 32 |
+
return search(query)
|
| 33 |
@tool
|
| 34 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 35 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 67 |
|
| 68 |
agent = CodeAgent(
|
| 69 |
model=model,
|
| 70 |
+
tools=[search_query,get_current_time_in_timezone,image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
|
| 71 |
max_steps=6,
|
| 72 |
verbosity_level=1,
|
| 73 |
grammar=None,
|