Hands-On Expert-Level Contract Summarization Using LLMs
Discover how we use LLMs for robust high-quality contract summarization and understanding for our legal clients as well as other businesses.
A common problem with modern online stores is that potential customers are unable to find the exact products they are looking for, especially when they don’t have a clear idea already of what products solve a specific issue. This leads to constant searching around, reading descriptions, or talking to support about how to solve their specific problem, and what products are needed for that.
However, using ai chatbots trained specifically on helping customers navigate through your store based on varying levels of understanding you can help customers find what they want quicker and easier, reducing churn and click aways.
In this article, find out how AI-powered Shopify chatbots can help discover shopping intent and improve customer satisfaction.
The Shopify App Store shows almost 200 chatbot apps that you can add to your store to help your customers with sales and/or customer support. But we found problems with most of the popular chatbot apps, including the ones claiming to be powered by AI:
To solve these common problems, we created our own framework for building and deploying AI-powered chatbots on Shopify e-commerce stores. This framework is based on the iterations we've built over the years implementing question-answering chatbots for a variety of medium and small businesses, often with enterprise data that are far more complex than e-commerce products.
Our framework integrates with multiple business systems to help customers as well as store administrators and staff with:
Additionally, our chatbots incorporate the best practices in human-computer interaction and its related psychology where research has shown that users prefer chatbots over traditional menu-based user interfaces but only when their cognitive load is lower and perceived autonomy is higher.
In the sections below, we explain the design and implementation of our framework for AI-powered Shopify chatbots.
Here’s our field-tested framework for integrating custom LLM-powered chatbots with Shopify.
Our chatbot platform and chatbots support the following capabilities out of the box:
The overall Shopify chatbot integration architecture is shown below.
The chatbot backend that is responsible for all the AI-powered smart answers is shown below:
Instead of a custom architecture, we could have relied on the OpenAI Assistants API. However, it has some drawbacks that make it unsuitable for this use case as of March 2024:
For these reasons, we use our own custom architecture. In the following sections, we go into more detail on the components shown above.
The conversational AI powering our chatbots must be able to:
We equip the GPT-4 LLM to do all this using our advanced prompting framework described below.
Our prompting framework is designed to help the LLM plan on how to answer a complex question by combining reasoning with the ability to decide what external information it needs and requesting the controller to fetch that information on its behalf from external data sources (like Shopify).
Under this framework, the LLM is able to reason that in order to answer a complex question comprehensively and accurately, it must break down the question into distinct actions that require interfacing with external systems.
Our prompting framework powers use cases like product searches with multiple criteria:
We implement custom actions using a custom LLM based tooling framework. The advantage of the framework is that it provides a much more structured and reliable way to specify actions and receive action requests compared to the ad hoc approaches of most LLMs. In this use case these are normally external APIs to inventory data, CRMs, or support APIs. The system will treat these as “actions” they can interact with to improve the data it can use.
OpenAI's API enables you to specify actions and their information in great detail as shown below:
GPT-4 uses that semantic information and metadata — the function description, parameter property descriptions, parameter units, and so on — to make better decisions on when to invoke your actions based on your queries.
GPT-4 also enables the structured invocation of actions and transmission of action responses back to the LLM.
Let's explore how our chatbot, with its advanced prompting framework driving GPT-4, integrates deeply with Shopify.
The first step in the workflow is to import all the product details into the chatbot backend to facilitate product search. Our framework sets up a completely automated data sync system that automatically pulls the data and also updates itself whenever there is any change in product details done from the Shopify dashboard or from another system.
All this is configured for the first time from your admin dashboard.
When the import is started, it sets up product semantic search as follows:
We use Shopify Webhooks to automate our chatbot data syncing. The backend is notified of any product updates in your store automatically by Shopify through the webhook. If there's any update, the following steps run:
Let's now explore what happens when one of your store visitors engages with our chatbot.
When the user enters their first reply in the chat, the following steps run:
The coolest thing here is that our model is trained to understand “abstract” ideas specific to the store's domain. Things like “stylish”, “gothic”, “artist” etc are understood by the model due to the training. This gives our model much better results in the fashion and apparel industry, and this same fine-tuning process to domain specific queries can be done to any use case.
In the product query function callback, the backend queries the vector database for the nearest semantic match for the query.
When a customer or internal query is received, it's first converted to a query embedding using the same embedding generator that was used in the product import step.
It then searches the vector database for embeddings that are nearest neighbors of the query embedding.
The vector database returns a list of semantic matches but they're often not close to the user's shopping intent.
So we ask the LLM to reason about the matches and eliminate any product that doesn't match any criteria.
Our prompting framework now runs the reasoning step:
The result of this reasoning step is a shorter list of better product recommendations that satisfy all the criteria so far, as shown below:
After each reply from the user, the product querying and reasoning steps are repeated. Each reply from the user is treated as an additional set of criteria by the reasoning step in order to eliminate any non-matches, as shown in the customer interaction below:
Our prompting framework is designed to classify a query into product search queries, order status queries, inventory queries, or possibly some combination of them.
If the framework determines that order status information is required, it requests a custom action to query the Shopify Order API and send back the information to the LLM.
Similarly, if the query requires current inventory details, the prompting framework requests a custom action to fetch the details from the Shopify InventoryItem API and send back the details to the LLM.
Often, customer product queries as well as support queries can be better answered by including information extracted from static documents like product frequently asked questions (FAQs), manuals, flyers, service guides, application notes, possibly third-party review articles, datasheets, and similar resources.
Our prompting framework's retrieval augmented generation (RAG) capabilities enable it to include such static information as well in its replies to product, support, and employee queries.
By a process of incremental elimination, the our system approach enables the chatbot to zero in on the shopping intent that the customer has in mind.
Both the text and backend product images are taken into account so the model can actually look at the product images relative to the query. This helps with those “abstract” searches we talked about above.
In this article, we showed how our chatbots enable your website visitors to zoom in on their shopping intent using chat as the primary user interface instead of the more traditional catalog or filtered search interfaces.
Finding the exact product that they had in mind helps boost sales, conversion rates, customer retention, and lifetime value.
Contact us if you want such AI capabilities in your e-commerce business.