Just admit it: you can hardly name an industry that has undergone as many transformations as eCommerce did in recent years. Since the COVID-19 pandemic has led to entirely different consumer behavior, and now the technologies are only accelerating the changes.
The rise of AI-empowered tools has marked a new era. Businesses can already build a customer-centric online store with AI, and buyers make more informed purchasing decisions while Chat GPT improves their customer experience. And you cannot lag in this fierce race; otherwise, you’ll lose your audience: two-thirds of online shoppers claim to leave the e-store (even their favorite one) if they don’t find what they need fast.
Yes, Chat GPT (and other Large Language Models for commercial use) can show great results here by engaging customers with human-like conversational behavior. However, even the most powerful technology is worth nothing without 2 things:
- The appropriate way to leverage it;
- The relevant context.
The first point is achievable: you try, you learn, you train, test, improve, and repeat.
The second one is only possible with up-to-date information. And here comes the problem because, as you might know, the bold Chat GPT doesn’t give the most recent data, which diminishes all previous efforts in building a smooth customer experience.
We at UnidataLab are constantly addressing and solving such issues. This time, we experimented with the tool that cracks the request-context-reply concern. And we’ll show you how it can help eCommerce businesses by fetching and extracting the most recent data, potentially decreasing the churn rate. But let’s start with the basics.
What Is LangChain?
Emerging as a game-changing technology, large language models (LLMs) are revolutionizing developers’ capabilities, enabling them to create previously elusive applications. However, as we already said, relying solely on LLMs is often inadequate for harnessing the full potential of these applications. The true power emerges when you combine LLMs with other sources of computation or knowledge.
And here’s the time for the LangChain library to enter the game. It aims to provide comprehensive support to facilitate the development of such applications. The library offers assistance in the following:
❓ question answering over specific documents;
💬 chatbots;
🤖 agents.
Agents, in particular, involve LLMs in:
- making decisions;
- taking actions;
- observing outcomes;
- iterating until completion.
To streamline the process, LangChain offers a standardized interface for agents, various agent options, and practical examples of end-to-end agents.
How It Works
The library applies the Chain of Thought (CoT), a prompting technique that encourages the model to generate a series of intermediate reasoning steps. This approach offers several appealing attributes.
- The technique enables models to break down complex problems into manageable intermediate stages, allowing for the allocation of additional computation to tasks that require more reasoning steps.
- It provides transparency into the model’s behavior, shedding light on its decision-making process and aiding in identifying and resolving potential reasoning errors. Although fully understanding the model’s computations supporting a given answer remains challenging, this technique offers interpretability.
- This type of reasoning applies to tasks such as math word problems, commonsense reasoning, and symbolic manipulation, encompassing various challenges that can be tackled through language-based solutions.
- Eliciting chain-of-thought reasoning in large off-the-shelf language models is relatively straightforward by incorporating examples of such sequences in the few-shot prompting exemplars.
The experiment employs sequential chains, which are chains that run their links in a predefined order. For example, suppose we want to ask the question: “Recommend me a smartphone with a low price” with the dataset below. In that case, it will run this chain:

In all cases, firstly, it processes the dataset using pandas utilities to extract the desired item from the database and do it until it reaches the final answer and then gives it to the user.
The Experimental Part
For the experiment, we place a relevant database with products at the input and then drop different prompts on them. This way, we simulate customers’ requests through a chatbot on an eCommerce website to give clear and personalized answers. In other words, we created a database of Amazon products for the experiment. However, we can build something similar for your customized business needs.
This is a dataset with 20 smartphones, collected from Amazon:
| Title | Memory Storage | Ram Memory | Price | Availability | Screen Size | Color |
| Google Pixel 7a – Unlocked Android Cell Phone … | 128 GB | 8 GB | 549.00 | Not available | 6.1 Inches | Sea |
| Tracfone Samsung Galaxy A13 5G Prepaid Smartph… | 64 GB | 4 GB | 117.00 | Available | 6.5 Inches | Black |
| OnePlus Nord N200 | 5G Unlocked Android Smartp… | 64 GB | 4 GB | 115.41 | Available | 6.49 Inches | Blue Quantum |
| Google Pixel 7-5G Android Phone – Unlocked Sma… | 128 GB | 8 GB | 392.00 | Available | 6.3 Inches | Obsidian |
| SAMSUNG Galaxy S21 FE 5G Cell Phone Factory U… | 256 GB | 8 GB | 823.79 | Not available | 6.4 Inches | Graphite |
| Sony Xperia 1 IV 512GB Factory Unlocked Smartp… | 512 GB | 12 GB | 929.96 | Temporarily out of stock | 6.5 Inches | Violet |
| Motorola edge | Unlocked | Made for US by Moto… | 256 GB | 6 GB | 700.00 | Available | 6.7 Inches | Solar Black |
| Google Pixel 7 Pro – 5G Android Phone – Unlock… | 128 GB | 12 GB | 999.00 | Available | 6.7 Inches | Obsidian |
| Moto G fast | 2020 | Unlocked | Made for the US by… | 32 GB | 3 GB | 200.00 | Available | 6.4 Inches | White |
| Tracfone Samsung Galaxy A03s 32GB Black – Prep… | 32 GB | 3 GB | 70.00 | Available | 6.5 Inches | Black |
| SAMSUNG Galaxy S22 Ultra Cell Phone Factory Un… | 128 GB | 6 GB | 700.00 | Available | 6.8 Inches | Phantom Black |
| OnePlus 10 Pro | 5G Android Smartphone | 8GB+1… | 128 GB | 8 GB | 348.74 | Available | 6.7 Inches | Volcanic Black |
| REDMAGIC 8 Pro Smartphone 5G 120Hz Gaming Phon… | 512 GB | 16 GB | 899.00 | Not available | 6.8 Inches | Black |
| OnePlus Nord N100 Midnight Frost Unlocked Smar… | 64 GB | 4 GB | 149.68 | Available | 6.52 Inches | Midnight Frost |
| SAMSUNG Galaxy A20 6.4″ 32GB GSM Unlocked 4G L… | 32 GB | 3 GB | 128.00 | Available | 6.4 Inches | Black |
| Google Pixel 6 Pro – 5G Android Phone – Unlock… | 256 GB | 12 GB | 380.00 | Available | 6.7 Inches | Stormy Black |
| Sony Xperia XZ (F8331) – 32GB – 23MP – Single … | 32 GB | 3 GB | 400.00 | Available | 5.2 Inches | Mineral Black |
| Xiaomi Poco X5 5G Dual SIM 265GB + 8GB Factory… | 256 GB | 8 GB | 320.00 | Available | 6.67 Inches | Black |
| Sony Xperia 5 III 125GB 5G Factory Unlocked Sm… | 128 GB | 8 GB | 640.00 | Available | 6.1 Inches | Green |
| OnePlus 9 Astral Black 5G Unlocked Android Sma… | 128 GB | 8 GB | 295.00 | Available | 6.55 Inches | Astral Black |
Corresponding to the dataset here are some examples of questions:
- Recommend me a smartphone with 8 GB RAM
The recommended smartphone with 8 GB RAM or more and available is the Google Pixel 7-5G Android Phone – Unlocked Smartphone with Wide Angle Lens and 24-Hour Battery – 128GB – Obsidian.
- Recommend a smartphone with low price.
The Tracfone Samsung Galaxy A03s 32GB Black – Prepaid Smartphone is the lowest-priced smartphone at $70.
- Write me the best smartphone.
The best smartphone is the Google Pixel 7 Pro – 5G Android Phone – Unlocked Smartphone with Wide Angle Lens and 24-Hour Battery – 128 GB – Obsidian.
- Write me the best smartphone at a low price.
The best smartphone at a low price is the Tracfone Samsung Galaxy A03s 32GB Black – Prepaid Smartphone.
- Find me a smartphone in red color.
There are no red color smartphones in the data frame.
- Find a smartphone with the highest price and write its name and price.
Google Pixel 7 Pro – 5G Android Phone – Unlocked Smartphone with Wide Angle Lens and 24-Hour Battery – 128 GB – Obsidian with a price of 999.00.
- Recommend me 2 smartphones in a range from 200$ to 500$.
The two recommended smartphones in the given range are Google Pixel 7-5G Android Phone and OnePlus 10 Pro.
- Recommend a smartphone up to 800$ and write its price.
The recommended smartphone is the Motorola Edge with a price of 700$.
- Write 2 smartphones with black color.
Tracfone Samsung Galaxy A13 5G Prepaid Smartphone (Locked) – Black – 64GB – Sim Card Included – CDMA and Tracfone Samsung Galaxy A03s 32GB Black – Prepaid Smartphone.
- Write all smartphones with 256 GB memory.
The smartphones with 256 GB memory are the SAMSUNG Galaxy S21 FE 5G Cell Phone, Motorola Edge, Google Pixel 6 Pro, and Xiaomi Poco X5 5G Dual SIM.
- Recommend me the smartphone model with the biggest screen.
The model with the biggest screen size is the SAMSUNG Galaxy S22 Ultra Cell Phone Factory Unlocked Android Smartphone 128GB Phantom Black.
- Write me a smartphone model close to the average price.
Google Pixel 7a – Unlocked Android Cell Phone – Smartphone with Wide Angle Lens and 24-Hour Battery – 128 GB – Sea with $50 Amazon Gift Card.
- Recommend me a smartphone for games.
The recommended smartphones for games are the Sony Xperia 1 IV 512GB Factory Unlocked Smartphone, the REDMAGIC 8 Pro Smartphone 5G 120Hz Gaming Phone, and the Google Pixel 6 Pro – 5G Android Phone – Unlocked Smartphone.
- Recommend a smartphone for watching videos.
The recommended smartphone for watching videos is the SAMSUNG Galaxy S22 Ultra Cell Phone Factory Unlocked Android Cell Phone with 128 GB Memory Storage and 6 GB Ram Memory.
To Line Up
As we can see, integrating the LangChain framework within ChatGPT shows great potential for enhancing the e-commerce experience. LangChain can help businesses decrease the burden of requests put on human support and transfer them to requests where the model is unsure about the answer.
The framework enables the modeling of complex conversational flows, allowing businesses to streamline customer support, provide personalized recommendations, and assist with product selection. This innovative approach empowers businesses to deliver a more tailored and interactive shopping experience, increasing customer satisfaction and conversion rates and raising incomes as a result.
As the e-commerce landscape continues to evolve, adopting frameworks like LangChain presents an exciting opportunity for businesses to harness the power of conversational AI and revolutionize how they engage with their customers in the online marketplace.
We at UnidataLab embrace these advancements and can help you shape the future of e-commerce. Interested? Let’s discuss it!



