# 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."