JasonJy14 commited on
Commit
c9e4aea
Β·
verified Β·
1 Parent(s): b7bf918

Create tools.py

Browse files
Files changed (1) hide show
  1. tools.py +144 -0
tools.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # tools.py
2
+ # Additional tools for Alfred the Gala Agent
3
+
4
+ from smolagents import tool
5
+ import datetime
6
+
7
+
8
+ @tool
9
+ def get_current_time() -> str:
10
+ """
11
+ Gets the current date and time.
12
+ Use this when you need to know what time it is for scheduling or time-related questions.
13
+
14
+ Returns:
15
+ The current date and time as a formatted string
16
+ """
17
+ now = datetime.datetime.now()
18
+ return f"Current date and time: {now.strftime('%A, %B %d, %Y at %I:%M %p')}"
19
+
20
+
21
+ @tool
22
+ def calculate_party_budget(
23
+ num_guests: int,
24
+ cost_per_guest: float,
25
+ venue_cost: float,
26
+ entertainment_cost: float
27
+ ) -> str:
28
+ """
29
+ Calculate the total budget needed for the gala party.
30
+
31
+ Args:
32
+ num_guests: Number of guests attending
33
+ cost_per_guest: Cost per guest (food, drinks, favors)
34
+ venue_cost: Cost of the venue rental
35
+ entertainment_cost: Cost of entertainment (DJ, dancers, etc.)
36
+
37
+ Returns:
38
+ A breakdown of the party budget
39
+ """
40
+ guest_total = num_guests * cost_per_guest
41
+ total = guest_total + venue_cost + entertainment_cost
42
+
43
+ return f"""
44
+ πŸŽ‰ GALA BUDGET BREAKDOWN πŸŽ‰
45
+ ━━━━━━━━━━━━━━━━━━━━━━━━━
46
+ Guests: {num_guests} Γ— ${cost_per_guest:.2f} = ${guest_total:.2f}
47
+ Venue: ${venue_cost:.2f}
48
+ Entertainment: ${entertainment_cost:.2f}
49
+ ━━━━━━━━━━━━━━━━━━━━━━━━━
50
+ TOTAL: ${total:.2f}
51
+ """
52
+
53
+
54
+ @tool
55
+ def suggest_seating_arrangement(guest_names: str, table_size: int) -> str:
56
+ """
57
+ Suggest a seating arrangement for guests.
58
+
59
+ Args:
60
+ guest_names: Comma-separated list of guest names
61
+ table_size: Number of seats per table
62
+
63
+ Returns:
64
+ A suggested seating arrangement
65
+ """
66
+ guests = [name.strip() for name in guest_names.split(",")]
67
+ num_guests = len(guests)
68
+ num_tables = (num_guests + table_size - 1) // table_size
69
+
70
+ arrangement = "πŸͺ‘ SEATING ARRANGEMENT πŸͺ‘\n"
71
+ arrangement += "━" * 30 + "\n"
72
+
73
+ for table_num in range(num_tables):
74
+ start_idx = table_num * table_size
75
+ end_idx = min(start_idx + table_size, num_guests)
76
+ table_guests = guests[start_idx:end_idx]
77
+
78
+ arrangement += f"\nπŸ“ Table {table_num + 1}:\n"
79
+ for guest in table_guests:
80
+ arrangement += f" β€’ {guest}\n"
81
+
82
+ return arrangement
83
+
84
+
85
+ @tool
86
+ def dietary_check(dietary_requirement: str) -> str:
87
+ """
88
+ Check common dietary requirements and suggest menu options.
89
+
90
+ Args:
91
+ dietary_requirement: The dietary requirement to check (e.g., vegetarian, vegan, gluten-free, halal, kosher)
92
+
93
+ Returns:
94
+ Menu suggestions for the dietary requirement
95
+ """
96
+ menus = {
97
+ "vegetarian": """
98
+ πŸ₯— VEGETARIAN MENU OPTIONS:
99
+ β€’ Stuffed bell peppers with quinoa
100
+ β€’ Mushroom risotto
101
+ β€’ Caprese salad with fresh mozzarella
102
+ β€’ Vegetable lasagna
103
+ β€’ Spinach and ricotta ravioli
104
+ """,
105
+ "vegan": """
106
+ 🌱 VEGAN MENU OPTIONS:
107
+ β€’ Grilled vegetable platter
108
+ β€’ Coconut curry with tofu
109
+ β€’ Mediterranean mezze board
110
+ β€’ Mushroom and walnut "meatballs"
111
+ β€’ Fresh fruit tart with coconut cream
112
+ """,
113
+ "gluten-free": """
114
+ 🌾 GLUTEN-FREE MENU OPTIONS:
115
+ β€’ Grilled salmon with herb butter
116
+ β€’ Rice paper spring rolls
117
+ β€’ Quinoa stuffed tomatoes
118
+ β€’ Flourless chocolate cake
119
+ β€’ Fresh fruit platter
120
+ """,
121
+ "halal": """
122
+ πŸ– HALAL MENU OPTIONS:
123
+ β€’ Lamb kofta with yogurt sauce
124
+ β€’ Chicken shawarma
125
+ β€’ Beef kebabs with rice pilaf
126
+ β€’ Baklava dessert
127
+ β€’ Fresh salads
128
+ """,
129
+ "kosher": """
130
+ ✑️ KOSHER MENU OPTIONS:
131
+ β€’ Roasted chicken with vegetables
132
+ β€’ Gefilte fish appetizer
133
+ β€’ Matzo ball soup
134
+ β€’ Brisket with roasted potatoes
135
+ β€’ Honey cake dessert
136
+ """
137
+ }
138
+
139
+ requirement_lower = dietary_requirement.lower()
140
+
141
+ if requirement_lower in menus:
142
+ return menus[requirement_lower]
143
+ else:
144
+ return f"I don't have specific menu suggestions for '{dietary_requirement}'. Please consult with the catering team for custom options."