Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 3 Current »

Objective

To ensure that our AI ordering bot only submits orders that are accurate, meet all item requirements, and include no erroneous or incorrect options. This process will validate each item in real-time as it’s added and store it for final review and submission.


Process Overview

  1. Real-Time Item Validation
    Each item is validated for required options as it is added. This includes:

    • Validating required fields (e.g., mandatory toppings, sizes).

    • Ensuring no erroneous options are added (e.g., options that shouldn’t apply to that item).

  2. Final Validation and Recap
    At the end of the ordering process, the bot will perform a final validation by recalling all items stored in an orderItems array, confirming the order’s accuracy, and calculating the total.


Detailed Steps

  1. Initiate Order Collection

    • Step 1: Ask if the order is for takeout or delivery.

    • Step 2: Ask if the order is for immediate preparation or at a specific time.

  2. Collect Items and Validate Real-Time
    For each item the user wants to add:

    • Step 3a: Match the user’s input to the closest menu item (ItemName).

    • Step 3a1:

      • If ItemName options = True:

        • Retrieve the menuItemID for the item.

        • Fetch item details (required/optional options) using the 'getMenuItemInfo' tool.

      • Step 3a2:

        • If ItemName options = False:

          • Add the item directly to the orderItems array and proceed.

    • Step 3b: For items with options:

      • Use the getMenuItemInfo tool to fetch the item’s option requirements.

      • Follow instructions to guide the user through required and optional options for that item.

    • Step 3c: Validate each item in real-time by:

      • Calling the ValidateOrder tool with the item’s menuItemID and selected options to ensure all required options are chosen.

      • If validation fails, prompt the user to provide missing information, adjusting options as needed.

    • Step 3d: Once validated, add the item to an orderItems array with its quantity and options.

    • Step 4: Ask, "What else can I get for you?"

      • Repeat Steps 3a–3d for each additional item.

  3. Store Validated Items

    • All validated items are stored in the orderItems array with complete details (item ID, quantity, options).

    • This array serves as a record to enable accurate final review and total calculation.

  4. Final Validation and Recap

    • Step 4a: Perform a last validation on the orderItems array:

      • Ensure that all required fields for each item are met.

      • Verify that there are no duplicate or incorrect options.

    • If the ValidateOrder tool returns any errors at this stage, prompt the user to make adjustments.

    • Step 5: Recap the Order

      • List each item, including selected options and quantities, and present the total to the user.

      • Avoid breaking down individual prices unless specifically asked.

  5. Order Confirmation and Submission

    • Step 6: Confirm the user’s phone number for SMS order confirmation.

    • Trigger the sendConfirmationSMS tool, including phoneNumber, customerName, orderType, deliveryAddress, orderTime, orderItems, and orderTotal.

    • Await confirmation from the sendConfirmationSMS tool before proceeding.

    • Step 7: End the call with a confirmation that the order has been placed.


Validation Tools Overview

  1. getMenuItemInfo Tool:

    • Used to fetch menu item details, including required and optional options.

    • Triggered after identifying a menu item with options.

  2. ValidateOrder Tool:

    • Used at two stages:

      • Real-Time Validation: For each item as it’s added, to confirm all required fields are met.

      • Final Validation: On the full orderItems array to ensure completeness before submission.

  3. sendConfirmationSMS Tool:

    • Used to send an SMS confirmation after final validation.

    • Includes complete order details for the user’s review.


Final Order Object Format

  • orderItems: An array where each entry contains:

    • menuItemID: Unique ID of the item.

    • itemName: Name of the item.

    • quantity: Number of units.

    • selectedOptions: List of selected options, specifying required and optional fields.

  • Final Order Submission: When the order passes validation, the final order object (including the orderItems array) is passed to sendConfirmationSMS to ensure the user receives complete order details.

  • No labels