proj2.menu_generation
Maps a meal number to it's cooresponding meal as a string as well as its cooreponding meal time
Args: meal_number (int): The meal number to get the meal and order times for
Returns: str: The name of the meal as a string ("breakfast", "lunch", or "dinner") int: The time the meal is typically ordered at in HHMM format (in 24H time)
Raises: ValueError: if meal_number is not 1, 2, or 3
Converts a date string in YYYY-MM-DD format to the corresponding day of the week and returns the next date
Args: date (str): The date string in YYYY-MM-DD format
Returns: str: The next day, in YYYY-MM-DD format str: The corresponding day of the week ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
Raises: ValueError: if the date string is not in the correct format (YYYY-MM-DD) or is invalid
Grabs the LLM output and extracts the item ID from it
Args: output (str): The output from the llm_toolkit LLM
Returns: int: The item ID extracted from the LLM output
Raises: ValueError: if the LLM output does not match the expected format or if multiple matches are found
Limits the number of items to ITEM_CHOICES by randomly selecting items if necessary
Args: items (pd.DataFrame): The DataFrame containing the items num_choices (int): The maximum number of choices to return
Returns: List[int]: The list of item_ids of the selected items
Filters out menu items that contain any of the specified allergens from the provided DataFrame
Args: menu_items (pd.DataFrame): The DataFrame containing the menu items allergens (str): A comma-separated string of allergens to filter out
Returns: pd.DataFrame: The filtered DataFrame with menu items containing the specified allergens removed
Filters out restaurants that are closed at the specified time on the specified weekday
Args: restaurant (pd.DataFrame): The DataFrame containing the restaurant data weekday (str): The day of the week to check (e.g., "Mon", "Tue", etc.) time (int): The time to check in HHMM format (24H time)
Returns: pd.DataFrame: The filtered DataFrame with closed restaurants removed
MenuGenerator class that uses an LLM to generate menu items based on user preferences and restrictions