Spaces:
Sleeping
Sleeping
Update
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
|
|
|
|
| 9 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 10 |
@tool
|
| 11 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -34,8 +35,8 @@ def get_fun_fact(topic: str) -> str:
|
|
| 34 |
"""
|
| 35 |
try:
|
| 36 |
search_tool = DuckDuckGoSearchTool()
|
| 37 |
-
results = search_tool.
|
| 38 |
-
if results
|
| 39 |
fun_fact = results[0][:300]
|
| 40 |
return f"Here's a fun fact about {topic}: {fun_fact}"
|
| 41 |
else:
|
|
@@ -64,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 64 |
|
| 65 |
agent = CodeAgent(
|
| 66 |
model=model,
|
| 67 |
-
tools=[get_fun_fact, final_answer], ## add your tools here (don't remove final answer)
|
| 68 |
max_steps=6,
|
| 69 |
verbosity_level=1,
|
| 70 |
grammar=None,
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
|
| 9 |
+
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 35 |
"""
|
| 36 |
try:
|
| 37 |
search_tool = DuckDuckGoSearchTool()
|
| 38 |
+
results = search_tool.run(f"{topic} fun fact")
|
| 39 |
+
if results:
|
| 40 |
fun_fact = results[0][:300]
|
| 41 |
return f"Here's a fun fact about {topic}: {fun_fact}"
|
| 42 |
else:
|
|
|
|
| 65 |
|
| 66 |
agent = CodeAgent(
|
| 67 |
model=model,
|
| 68 |
+
tools=[get_fun_fact, search_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 69 |
max_steps=6,
|
| 70 |
verbosity_level=1,
|
| 71 |
grammar=None,
|