Reading Time: 12 minutes

Digital transformation is a tall order at the top of every organization’s to-do list. But what’s driving this trend that’s disrupting industries and redefining business models? While retailers and consumer goods companies are trying to navigate the continuously-evolving retail space, IT teams are overburdened, stakeholders are frustrated, budgets are deflating, and more – especially without a retail API strategy in place. 

MuleSoft and AI for online retailers 

There’s an endless list of initiatives that outline how businesses can act on digital transformation, but the “why” always leads back to the customer. Adopting technologies like AI helps to solve the existing gap and improve the customer experience. 

While we’ve previously discussed how to use AI within MuleSoft to create and use AI policies and how AI and MuleSoft can help create and design APIs specifications, this time we’ll go over how to use MuleSoft and AI to simulate an online retail shop with an enhanced customer experience.

There are different systems involved such as Salesforce, Database, Vector Database and RAG for the AI, and this online retail shop is a web API built using MuleSoft and AI capabilities.

MuleSoft’s AI-powered composability will help organizations prepare for and transition toward an AI-centered future. 

What features and capabilities does the retail shop offer? 

Here are some features and capabilities offered by the retail shop:  

  • Dynamic UI 
  • Retrieval-augmented generation (RAG) 
  • Query via Text Input for shopping c arts and Full Catalog data from Vector DB 
  • Query via Vocal Input for both shopping cart and Full Catalog data from Vector DB 
  • Add items to Vector DB and shopping carts from PDFs  
  • Listen to the AI response 
  • Translate the AI response in different languages 
  • Integrate with Salesforce for PriceBook, Products, and other SObjects 
  • Create an Order record on Salesforce 
  • Send an email with order summary information 

A customer can then access the shop and interact through different channels to find all the necessary information powered by the AI.

What systems are involved? 

Below are the most relevant systems and how they engage with the Mule AI Chain connectors. The full reference list is available as well: 

  • A SFTP server is used to collect all product technical data sheets in PDF format 
  • Pinecone is a vector database. It contains product-centered information taken directly from reading the PDF technical sheet and other useful information for the RAG to optimize the LLM output 
  • A MySQL database that contains other data that completes information related to the products in the shop’s online catalog 
  • Salesforce: The products within the catalog from the CRM along with other useful information. Additionally, Salesforce is used for PriceBook and order creation 

Understanding how the AI-enabled retail shop functions

We start from the homepage. There are some products in the catalog, the cart itself, and profile data. For now, the cart itself is disabled, but will be enabled once a product is added.

In the lower righthand corner, there’s a chatbot function that can be used to query the dataset – either from your cart or the full web catalog, listen to its response, translate if necessary, or query using a vocal input.

Now, let’s see how everything works together. You can see products inside of the catalog, choose the product of your interest, and add it to the shopping cart.

Adding a product to the shopping cart

When you add a product to the shopping cart, what happens in the background? Using the ProductID, the product’s technical sheet is read and data is inserted into the vector database. The operation adds a document into an embedding store and exports it to a file. The document is then ingested into an external vector database. 

Asking the chatbot a text-based query

Let’s consider another scenario. If we add a second product to the shopping cart, we can query the dataset using the chat, talking to the AI. It will provide answers based on whatever data is present in the vector database, referring to the products present in the cart or entire web catalog. For example, if you ask, “Are there any yellow-colored products in my shopping cart?” the AI can accurately return a response noting that no, there are no yellow-colored products in the cart at the present time.

You might be curious what happens in the background for this scenario. The operation Embedding Query from Store retrieves information based on a plain text prompt from an embedding store. The response provided is then enriched via the Agent Define Prompt Template operation that allows to define and compose AI functions using plain text, enabling the creation of natural language prompts, generating responses, extracting information, invoking other prompts, or performing any text-based task.

Let’s ask the AI another question. “Do I have any black shoes in my cart?” The AI will again accurately respond that no such item exists in the cart at the present moment.

Using voice-to-text to speak to the chatbot

Another important feature that goes beyond text-based queries is voice-to-text querying capabilities in which users can speak to the AI and listen to verbal responses to queries.

We want to understand what mechanisms allow us to listen to the responses provided by AI since this process differs from solely text-based interactions. In the scenario above, the Text to Speech operation takes the response previously provided by the AI ​​and converts it into an audio file. This file is then embedded in the html code so that it can be used through a media player.

Translating responses from the chatbot

What if we want to receive our answer in another language? There’s a function for that, too!

In the background, once a user selects which language they want their content translated to, the AI uses a Chat Answer Prompt operator with a plain text prompt as input and responds with a plain text answer, which is nothing more than our translated answer.

Placing an order

We’re able to view what products we added to our cart along with pricing and shipping costs. Clicking on Order will create the order in Salesforce via a data orchestration between different SObjects. The user will receive an email with the relevant order information. It will look like this to users:

Behind the scenes, here’s what happened: there is an orchestration between different Salesforce SObjects (PriceBook, Products, PriceBookEntry) that then processed and created a new Order record in the CRM. Once an Order is created, an email will be auto-created with details from the order.

Build more with MuleSoft  

We’ve seen how to create an online retailer using MuleSoft, along with other tools, connectors, and systems, including artificial intelligence as a key supporting factor. 

Composability is inherently flexible, and it empowers organizations to rapidly adopt new standards and technologies. To help customers build a composable architecture, Anypoint Platform can help. AI-powered composability is MuleSoft’s solution to organizations’ problems, with the goal of helping build a foundation for the new AI era with different benefits.

To see the full demonstration and learn how to create your own online retail shop with MuleSoft and AI, watch this demo video