BoddyGus commited on
Commit
65151ac
·
verified ·
1 Parent(s): 53fed3a

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +5 -0
  2. requirements.txt +1 -0
  3. tool.py +27 -0
app.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from smolagents import launch_gradio_demo
2
+ from tool import SimpleTool
3
+
4
+ tool = SimpleTool()
5
+ launch_gradio_demo(tool)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ smolagents
tool.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import Tool
2
+ from typing import Any, Optional
3
+
4
+ class SimpleTool(Tool):
5
+ name = "suggest_menu"
6
+ description = "Suggest a menu based on the occasion."
7
+ inputs = {'occasion': {'type': 'string', 'description': 'The type of occasion for the party. Allowed values are: -"casual": Menu for casual party. -"formal": Menu for formal party. -"superhero": Menu for superhero party. -"custom": Custom menu.'}}
8
+ output_type = "string"
9
+
10
+ def forward(self, occasion: str) -> str:
11
+ """
12
+ Suggest a menu based on the occasion.
13
+ Args:
14
+ occasion (str): The type of occasion for the party. Allowed values are:
15
+ -"casual": Menu for casual party.
16
+ -"formal": Menu for formal party.
17
+ -"superhero": Menu for superhero party.
18
+ -"custom": Custom menu.
19
+ """
20
+ if occasion == "casual":
21
+ return "Pizza, snacks, and drinks."
22
+ elif occasion == "formal":
23
+ return "3-course dinner with wine and dessert."
24
+ elif occasion == "superhero":
25
+ return "Buffet with high-energy and healthy food."
26
+ else:
27
+ return "Custom menu for the butler."