An AI Shopping Assistant with Sitecore OrderCloud and OpenAI GPT4 Model

Recently, OpenAI launched an Assistants API. It allows you to build an intelligent assistant for your application. You can add instructions for the assistant and based on intelligence it can call up APIs. There is also an assistant playground that you can use to explore the Assistant's capabilities. It is important to know that the Assistant API is in Beta version right now and more functionalities are being added to it.

Sitecore OrderCloud is a B2B, B2C, B2X commerce and marketplace development platform, with a cloud-based, API-first, headless eCommerce architecture. We wanted to build a proof-of-concept (POC) around an AI-powered assistant that talks to your storefront. It can search products, add to cart, present shipping options, add addresses, use credit cards on file, and submit an order.

The assistant uses the GTP -4-1106 Preview model and uses a retrieval method to generate a response.

Getting Started

Define the Assistant in the OpenAI portal:

custom

This is what a conversation with the assistant may look like:

custom

The assistant proceeds to help the customer find the right product. After which, it will ask the customer if they want the product to be added to cart and start to checkout or continue shopping.

custom

The assistant then asks which shipping option the customer would like to use. The customer can request to use an existing shipping and billing address with whatever credit card is on file to submit the order. This is the output from the POC. In a real-world scenario, this will be built with a modern UI framework. custom custom custom

When viewing the order history of the customer, the order shows up. custom

Here is the full transcript:

Your message: Can you show me some speakers with bluetooth for my room?
Working on it.....
Just a little bit more...
Working on it.....
Just a little bit more...
Working on it.....
Just a little bit more...
Working on it.....
Just a little bit more...
Assistant: I've found a couple of Bluetooth-enabled speakers that could be suitable for your room:

1. **80W 3-Way Amplified Speaker**
   - Features: Wi-Fi, Ethernet, and Bluetooth compatibility with various devices.
   - Power: 80W providing plenty of power for any room.
   - Description: Suitable for use with smartphones, tablets, desktops, and other enabled devices.
   - Product ID: 6042106

2. **ShelfLink Capsule Portable Bluetooth Speaker**
   - Features: Waterproof and portable, allows connection up to three devices simultaneously.
   - Convenience: Charge mobile devices with the dual USB port while playing music.
   - Description: Ideal for music outdoors, by the pool, or anywhere else.
   - Product ID: 6042107

3. **SoundArt Bluetooth Soundbar with Digital Amplifier**
   - Features: Thin design, deep bass, high-quality mids, and highs with Bluetooth connectivity.
   - Additional: Comes with a remote control to adjust volume from anywhere in the room.
   - Description: Designed to enhance the home theater experience.
   - Product ID: 6042074

Would you like to know the price of any of these products? If so, please tell me the product ID you're interested in.
Your message: Option 2
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Assistant: The ShelfLink Capsule Portable Bluetooth Speaker is priced at $180.00. Would you like to proceed with purchasing this item? If yes, please let me know the quantity you wish to order.
Your message: Yes, 1
Working on it.....
        I need to fetch some more information, give me some time.
productId : 6042107
Working on it.....
Just a little bit more...
Assistant: Your ShelfLink Capsule Portable Bluetooth Speaker has been added to the cart successfully. Your cart total is now $894.99 with a total of 6 items. 
Are you interested in checking out the cart?
Your message: Yes
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Just a little bit more...
Assistant: Please choose the address you would like to use for checkout:

1. **Default Buyer**
   - Address: 110 5th St, Minneapolis, Minnesota, 55403, US

2. **Amrit Raj**
   - Address: 2 Venture, Ste 450, Irvine, CA, 92618, US (XCENTIUM Headquarters)

Which address should I use for your billing and shipping?
Your message: Option 2
Working on it.....
Just a little bit more...
        I need to fetch some more information, give me some time.
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Just a little bit more...
Working on it.....
Just a little bit more...
Assistant: Here are the available shipping method options for your order:

1. **STANDARD OVERNIGHT**
   - Carrier: FedEx
   - Cost: $14.99
   - Estimated Transit Days: 1 day
   - Guaranteed delivery

2. **FEDEX 2 DAY**
   - Carrier: FedEx
   - Cost: $6.99
   - Estimated Transit Days: 2 days
   - Guaranteed delivery

Please let me know which shipping method you would prefer for your order.
Your message: Option 1
Working on it.....
Just a little bit more...
        I need to fetch some more information, give me some time.
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Assistant: You have the following credit card on file:

- **Card Type**: Visa
- **Cardholder Name**: Test Testerson
- **Partial Account Number**: ****1111
- **Expiration Date**: June 2027

Would you like to use this credit card for the order?
Your message: Yes
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Just a little bit more...
Assistant: The credit card has been successfully added to your order. 

Here are your updated cart details:
- Cart Total: $971.81
- Shipping Cost: Included in cart total
- Total Items in Cart: 6

Would you like to submit the order now?
Your message: When will receive my products?
Working on it.....
Just a little bit more...
Working on it.....
Assistant: The shipping method you chose is "STANDARD OVERNIGHT" with FedEx, which guarantees delivery within 1 day. However, the exact delivery date can depend on factors such as the time the order is processed and the cut-off time for overnight shipping.

Would you still like to submit the order, or do you need assistance with anything else?
Your message: Yes, submit the order
Working on it.....
        I need to fetch some more information, give me some time.
Working on it.....
Just a little bit more...
Working on it.....
Just a little bit more...
Assistant: Your order has been successfully submitted with the following details:

- Order Total: $971.81
- Order Number: ilwVhhNHsU6sXPwcf3leDA
- Total Items in Cart: 6
- Expected Shipping Date: March 6, 2024
- Shipping Method: FedEx Standard Overnight

Thank you for your purchase! If you need further assistance or have any other questions, feel free to ask.
Your message:

We could integrate OpenAPI with Sitecore OrderCloud without any complexity. It certainly demonstrates that Sitecore OrderCloud is a true modern SasS based eCommerce platform that can integrate with cutting edge technologies seamlessly. As a business owner, Sitecore OrderCloud enables you to stay ahead of your competitors as well as when new technologies are introduced. If you would like to learn more about the assistant, please contact us or message me on LinkedIn

References