Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadded suggest_menu
app.py
CHANGED
|
@@ -37,6 +37,26 @@ my_image_tool = Tool.from_space(
|
|
| 37 |
description="Generate an image from a prompt"
|
| 38 |
)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
@tool
|
| 41 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 42 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -105,7 +125,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 105 |
|
| 106 |
agent = CodeAgent(
|
| 107 |
model=model,
|
| 108 |
-
tools=[
|
| 109 |
max_steps=6,
|
| 110 |
verbosity_level=1,
|
| 111 |
grammar=None,
|
|
|
|
| 37 |
description="Generate an image from a prompt"
|
| 38 |
)
|
| 39 |
|
| 40 |
+
@tool
|
| 41 |
+
def suggest_menu(occasion: str) -> str:
|
| 42 |
+
"""
|
| 43 |
+
Suggests a menu based on the occasion.
|
| 44 |
+
Args:
|
| 45 |
+
occasion (str): The type of occasion for the party. Allowed values are:
|
| 46 |
+
- "casual": Menu for casual party.
|
| 47 |
+
- "formal": Menu for formal party.
|
| 48 |
+
- "superhero": Menu for superhero party.
|
| 49 |
+
- "custom": Custom menu.
|
| 50 |
+
"""
|
| 51 |
+
if occasion == "casual":
|
| 52 |
+
return "Pizza, snacks, and drinks."
|
| 53 |
+
elif occasion == "formal":
|
| 54 |
+
return "3-course dinner with wine and dessert."
|
| 55 |
+
elif occasion == "superhero":
|
| 56 |
+
return "Buffet with high-energy and healthy food."
|
| 57 |
+
else:
|
| 58 |
+
return "Custom menu for the butler."
|
| 59 |
+
|
| 60 |
@tool
|
| 61 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 62 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 125 |
|
| 126 |
agent = CodeAgent(
|
| 127 |
model=model,
|
| 128 |
+
tools=[suggest_menu], ## add your tools here (don't remove final answer) #1-final_answer #2-get_hugging_face_top_daily_paper #3-get_current_time_in_timezone
|
| 129 |
max_steps=6,
|
| 130 |
verbosity_level=1,
|
| 131 |
grammar=None,
|