Spaces:
Sleeping
Sleeping
Thomas Hatting commited on
Update app.py
Browse filesUpdate CodeAgent
app.py
CHANGED
|
@@ -9,24 +9,21 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""
|
| 15 |
-
|
| 16 |
-
|
| 17 |
Args:
|
| 18 |
-
|
| 19 |
"""
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
"
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return best_service
|
| 30 |
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -66,7 +63,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 66 |
|
| 67 |
agent = CodeAgent(
|
| 68 |
model=model,
|
| 69 |
-
tools=[
|
| 70 |
max_steps=6,
|
| 71 |
verbosity_level=1,
|
| 72 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def suggest_menu(query: str) -> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""
|
| 15 |
+
Suggests a menu based on the occasion.
|
|
|
|
| 16 |
Args:
|
| 17 |
+
occasion: The type of occasion for the party.
|
| 18 |
"""
|
| 19 |
+
if occasion == "casual":
|
| 20 |
+
return "Pizza, snacks, and drinks."
|
| 21 |
+
elif occasion == "formal":
|
| 22 |
+
return "3-course dinner with wine and dessert."
|
| 23 |
+
elif occasion == "superhero":
|
| 24 |
+
return "Buffet with high-energy and healthy food."
|
| 25 |
+
else:
|
| 26 |
+
return "Custom menu for the butler."
|
|
|
|
|
|
|
| 27 |
|
| 28 |
@tool
|
| 29 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 63 |
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
+
tools=[DuckDuckGoSearchTool(), suggest_menu, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
|
| 67 |
max_steps=6,
|
| 68 |
verbosity_level=1,
|
| 69 |
grammar=None,
|