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