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:

  1. making decisions; 
  2. taking actions; 
  3. observing outcomes;
  4. 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.

  1. 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. 
  1. 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.
  1. 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. 
  1. 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:

Building the Context with the LangChain Framework

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:

TitleMemory StorageRam MemoryPriceAvailabilityScreen SizeColor
Google Pixel 7a – Unlocked Android Cell Phone …128 GB8 GB549.00Not available6.1 InchesSea
Tracfone Samsung Galaxy A13 5G Prepaid Smartph…64 GB4 GB117.00Available6.5 InchesBlack
OnePlus Nord N200 | 5G Unlocked Android Smartp…64 GB4 GB115.41Available6.49 InchesBlue Quantum
Google Pixel 7-5G Android Phone – Unlocked Sma…128 GB8 GB392.00Available6.3 InchesObsidian
SAMSUNG Galaxy S21 FE 5G Cell Phone Factory U…256 GB8 GB823.79Not available6.4 InchesGraphite
Sony Xperia 1 IV 512GB Factory Unlocked Smartp…512 GB12 GB929.96Temporarily out of stock6.5 InchesViolet
Motorola edge | Unlocked | Made for US by Moto…256 GB6 GB700.00Available6.7 InchesSolar Black
Google Pixel 7 Pro – 5G Android Phone – Unlock…128 GB12 GB999.00Available6.7 InchesObsidian
Moto G fast | 2020 | Unlocked | Made for the US by…32 GB3 GB200.00Available6.4 InchesWhite
Tracfone Samsung Galaxy A03s 32GB Black – Prep…32 GB3 GB70.00Available6.5 InchesBlack
SAMSUNG Galaxy S22 Ultra Cell Phone Factory Un…128 GB6 GB700.00Available6.8 InchesPhantom Black
OnePlus 10 Pro | 5G Android Smartphone | 8GB+1…128 GB8 GB348.74Available6.7 InchesVolcanic Black
REDMAGIC 8 Pro Smartphone 5G 120Hz Gaming Phon…512 GB16 GB899.00Not available6.8 InchesBlack
OnePlus Nord N100 Midnight Frost Unlocked Smar…64 GB4 GB149.68Available6.52 InchesMidnight Frost​
SAMSUNG Galaxy A20 6.4″ 32GB GSM Unlocked 4G L…32 GB3 GB128.00Available6.4 InchesBlack
Google Pixel 6 Pro – 5G Android Phone – Unlock…256 GB12 GB380.00Available6.7 InchesStormy Black
Sony Xperia XZ (F8331) – 32GB – 23MP – Single …32 GB3 GB400.00Available5.2 InchesMineral Black
Xiaomi Poco X5 5G Dual SIM 265GB + 8GB Factory…256 GB8 GB320.00Available6.67 InchesBlack
Sony Xperia 5 III 125GB 5G Factory Unlocked Sm…128 GB8 GB640.00Available6.1 InchesGreen
OnePlus 9 Astral Black 5G Unlocked Android Sma…128 GB8 GB295.00Available6.55 InchesAstral 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! 

Related Posts