Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
|
| 9 |
-
search_tool = DuckDuckGoSearchTool()
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
|
@@ -35,9 +34,9 @@ def get_fun_fact(topic: str) -> str:
|
|
| 35 |
A string reporting a fun fact related to the topic or an error message.
|
| 36 |
"""
|
| 37 |
try:
|
| 38 |
-
results =
|
| 39 |
if results:
|
| 40 |
-
fun_fact = results[
|
| 41 |
return f"Here's a fun fact about {topic}: {fun_fact}"
|
| 42 |
else:
|
| 43 |
return f"Sorry, I could not find a fun fact about {topic}."
|
|
@@ -65,7 +64,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 65 |
|
| 66 |
agent = CodeAgent(
|
| 67 |
model=model,
|
| 68 |
-
tools=[get_fun_fact,
|
| 69 |
max_steps=6,
|
| 70 |
verbosity_level=1,
|
| 71 |
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
|
|
|
|
| 34 |
A string reporting a fun fact related to the topic or an error message.
|
| 35 |
"""
|
| 36 |
try:
|
| 37 |
+
results = web_search(query=f"{topic} fun fact")
|
| 38 |
if results:
|
| 39 |
+
fun_fact = results[:300]
|
| 40 |
return f"Here's a fun fact about {topic}: {fun_fact}"
|
| 41 |
else:
|
| 42 |
return f"Sorry, I could not find a fun fact about {topic}."
|
|
|
|
| 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,
|