Spaces:
Sleeping
Sleeping
Update app.py
Browse filesadded websearch and image generation tools here
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 add_two_numbers(arg1:int, arg2:int) -> int:
|
| 23 |
"""A tool that adds two numbers
|
|
@@ -65,7 +77,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 65 |
|
| 66 |
agent = CodeAgent(
|
| 67 |
model=model,
|
| 68 |
-
tools=[final_answer, add_two_numbers], ## add your tools here (don't remove final answer)
|
| 69 |
max_steps=6,
|
| 70 |
verbosity_level=1,
|
| 71 |
grammar=None,
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def websearch_tool(search_query:str) -> str:
|
| 23 |
+
"""A tool that searches the web for a given query string
|
| 24 |
+
Args:
|
| 25 |
+
search_query: the query to search
|
| 26 |
+
"""
|
| 27 |
+
web_search_tool = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0)
|
| 28 |
+
results = web_search_tool(search_query)
|
| 29 |
+
|
| 30 |
+
return results
|
| 31 |
+
|
| 32 |
+
|
| 33 |
@tool
|
| 34 |
def add_two_numbers(arg1:int, arg2:int) -> int:
|
| 35 |
"""A tool that adds two numbers
|
|
|
|
| 77 |
|
| 78 |
agent = CodeAgent(
|
| 79 |
model=model,
|
| 80 |
+
tools=[final_answer, add_two_numbers, image_generation_tool, websearch_tool], ## add your tools here (don't remove final answer)
|
| 81 |
max_steps=6,
|
| 82 |
verbosity_level=1,
|
| 83 |
grammar=None,
|