What is happening at OpenAI? Sam Altman, the CEO of OpenAI, was fired on Friday by the board members. Over the weekend, there were discussions about bringing him back. The drama is still unfolding, and we have to wait to see what happens in the coming weeks.
This blog is not about OpenAPI, but it’s hard to start without mentioning it because it’s just such a shocking event for the future of Large Language Model (LLM). In a recent discussion with Cambridge audience, Sam Altman was asked whether another breakthrough is needed to achieve Artificial General Intelligence (AGI)? Sam’s answer was ‘yes, another breakthrough is needed’. Understanding how LLM works, we know that it uses language used by humans to find answers to questions. This is a very good article that explains how ChatGPT works. We express our thoughts using language, but is that enough for AI to create new ideas like humans? I don’t think so. Clearly, Sam thinks there are more than LLM needed to achieve AGI. But, there is no doubt LLM is extremely powerful and it can help us finding solutions for many problems. In this blog I will explore how LLM can be used to build product recommendation in Sitecore OrderCloud utilizing LLM and Sitecore CDP. This discussion will be on a proposed solution at the architecture level. Let’s dive into it!
So, why am considering LLM to build product recommendations in an e-commerce system? I think LLM can remove lots of complexity from the current approach of generating product recommendations which is mainly based on Collaborative Filtering, Content Filtering, and Hybrid Filtering. I discussed this previously in my article The Expanding Universe of Software Development. The filtering approach is complex and takes time to generate data for segmentation. Whereas using LLM will be much more real-time approach because it is based on product content and customer’s interest based on closeness of language.
Sitecore OrderCloud doesn’t have a product recommendation engine built in, but you can combine Sitecore Discover with OrderCloud for product recommendation. Sitecore Discover is part of Sitecore composable stack. It is based on same Collaborative Filtering algorithm. It comes with frontend widgets, a Javascript SDK, admin panel for analytics and product management. It works well and it doesn’t need CDP. What we are trying to do is to create a product recommendation solution based on LLM and Sitecore CDP. Not a product like Discover. It can be designed like a product though.
I will explain the working of this solution with an example. A website selling books wants to recommend books based on users’ browsing behavior and previous purchases.
- Send book title and author to CDP
- Read previously browsed and purchased books by the user from CDP
- Send the books and authors’ names to ChatGPT (LLM) API to find out the genres based on sent data
- Save the genres against the visitor in CDP
- Generate a list of books based on the genres provide by ChatGPT
- Show the list in recommended products
Here is an example
I can even ask for recommended books from ChatGPT but storing the genres in CDP and using the genre to generate the recommendations from OrderCloud is better because I can generate the books that are available in the online store, I can decide what to show based on my requirements, and also I can use the genres when next time same user visit the website even before start browsing books.
This solution works fine with ChatGPT and any kind of LLM services that provides API access to their models, but it will not work so well when the online commerce business is based on specialized products. This especially true in B2B commerce. ChatGPT or other LLM services are trained on scrubbing data from internet. We can’t feed the website products and contents ChatGPT. In this kind of situation we need to train LLM of our own using the products and contents used in the website. There are many open source LLMs available today. Two popular ones are Facebook’s Llama 2 and Claude 2 from Anthropic.
So here is the proposed solution
- Set up and train the LLM with the products and contents from the website. LLM will need periodic refresh as new products and contents will be updated.
- Create API interface against the trained LLM to return response to recommendation questions.
- Set up the website to send visitors’ data to Sitecore CDP using Stream APIs.
- Use Sitecore CDP Rest APIs to send order data.
- Use Sitecore CDP Rest APIs to retrieve users’ previously browsed and order products.
- Send users’ previously browsed and ordered product to LLM to learn users profile.
- Save this profile in CDP against users.
- Retrieve user’s profile from CDP using the Rest API.
- Send user’s profile to LLM for recommended products.
Above is an outline of how we can use LLM to build a Product Recommendation Engine. Actual implementation will require to consider many details. Product recommendation can be further improved with users data like their locations, language they speak, age, sex etc. LLM can also help with inventory management and forecasting, sentiment analysis, search and many other things that helps with e-commerce conversion.