Update app.py
#279
by
Irina2612
- opened
app.py
CHANGED
|
@@ -18,6 +18,33 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
# Tool to suggest a menu based on the occasion
|
| 22 |
+
|
| 23 |
+
def suggest_menu(occasion: str) -> str:
|
| 24 |
+
"""
|
| 25 |
+
Suggests a menu based on the occasion.
|
| 26 |
+
Args:
|
| 27 |
+
occasion (str): The type of occasion for the party. Allowed values are:
|
| 28 |
+
- "casual": Menu for casual party.
|
| 29 |
+
- "formal": Menu for formal party.
|
| 30 |
+
- "superhero": Menu for superhero party.
|
| 31 |
+
- "custom": Custom menu.
|
| 32 |
+
"""
|
| 33 |
+
if occasion == "casual":
|
| 34 |
+
return "Pizza, snacks, and drinks."
|
| 35 |
+
elif occasion == "formal":
|
| 36 |
+
return "3-course dinner with wine and dessert."
|
| 37 |
+
elif occasion == "superhero":
|
| 38 |
+
return "Buffet with high-energy and healthy food."
|
| 39 |
+
else:
|
| 40 |
+
return "Custom menu for the butler."
|
| 41 |
+
|
| 42 |
+
# Alfred, the butler, preparing the menu for the party
|
| 43 |
+
agent = CodeAgent(tools=[suggest_menu], model=HfApiModel())
|
| 44 |
+
|
| 45 |
+
# Preparing the menu for the party
|
| 46 |
+
agent.run("Prepare a formal menu for the party.")
|
| 47 |
+
|
| 48 |
@tool
|
| 49 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 50 |
"""A tool that fetches the current local time in a specified timezone.
|