Spaces:
Sleeping
Sleeping
Fixed DuckDuckGoSearchTool
Browse files
app.py
CHANGED
|
@@ -7,6 +7,17 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
|
@@ -57,7 +68,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
@tool
|
| 11 |
+
def duckduckgo_search(query: str) -> str:
|
| 12 |
+
"""A tool that searches the web
|
| 13 |
+
Args:
|
| 14 |
+
query: The search query string.
|
| 15 |
+
"""
|
| 16 |
+
try:
|
| 17 |
+
search_tool = DuckDuckGoSearchTool()
|
| 18 |
+
return search_tool(str);
|
| 19 |
+
except Exception as e:
|
| 20 |
+
return f"Error performing search: {str(e)}"
|
| 21 |
|
| 22 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 23 |
@tool
|
|
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
+
tools=[duckduckgo_search, get_current_time_in_timezone, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|