ShopAssist Reading Material
ShopAssist Reading Material
● API Calls and GPT-3.5 Model: You learnt how to make basic
API calls using Python to interact with the GPT-3.5 model
of OpenAI. The model has been extensively used in this
course to create the AI-based Shop Assist system.
● Prompt Engineering: You learnt the principles of prompt
engineering, including providing clear instructions and
enhancing the reasoning capabilities of the artificial
intelligence (AI) model. A five-component framework (task,
role, context, guidelines and output format) is utilised to
create effective prompts for better results.
● Enhancing the Reasoning Capabilities of the LLM: You
explored two techniques for enhancing the reasoning
capabilities of the AI model – chain of thought prompting
and few-shot prompting. These techniques will be
demonstrated in the Shop Assist AI system.
● Designing End-to-End LLM Systems: You covered the design of
end-to-end LLM systems comprising multiple components. Shop
Assist AI serves as an example of such a system,
incorporating conversation and information gathering, data
processing and product recommendation.
Project Background:
In today’s digital age, online shopping has become the preferred
option for many consumers. However, the vast array of choices
and the lack of personalised assistance can make the shopping
experience overwhelming and challenging. To address this issue,
we present ShopAssist AI. This chatbot combines the power of
LLMs and rule-based functions to provide accurate and reliable
recommendations during the online laptop shopping experience.
Problem Statement:
Given a dataset containing laptop information (product names,
specifications, descriptions, etc.), build a chatbot that parses
the dataset and provides accurate laptop recommendations based
on user requirements. This chatbot, named ShopAssist AI, will
- Interact with users,
- Understand their laptop requirements and
- Recommend the most suitable laptops from a dataset based on
their needs and preferences.
You can download the files used in this project from the
following link. The stub notebooks for the live sessions can be
accessed from the following link - Starter Notebooks
Dataset:
Let’s take a look at a quick overview of the laptop dataset used
in this project.
Why?
The important question you need to ask is the necessity of
creating such a complex and extensive system design. It should
be noted that multiple design considerations have been addressed
while designing the chatbot system. These include:
● LLM Hallucinations: Reduce or remove hallucinations from
LLM responses. For more information about hallucinations in
LLMs, you can refer to this link.
● LLM consistency and reproducibility: Ensure the output
responses from the language model (OpenAI) are
reproducible, consistent for the same set of input
parameters and correct. For example, OpenAI’s chat
completion API has provided functionality such as JSON
output parsing and seed argument. You can refer to the
following links for more information:
○ How to make your completions outputs consistent with
the new seed parameter | OpenAI Cookbook
○ ️
OpenAI API Guide: Using JSON Mode
○ OpenAI Documentation - Text generation -JSON Mode
● Utilise the LLM reasoning capabilities for certain
high-level tasks. This includes advanced prompt engineering
techniques you’ve covered previously such as Few-Shot
prompting, Chain-of-Thought prompting, Chain-of-Thought
Few-Shot prompting, Self-consistency prompting etc.
● Account for the limitations of LLMs: A key factor in
building LLM-based applications is understanding the
capabilities of LLMs. Throughout this project, you will
encounter various limitations of using simple prompts for
LLMs and dive deeper into various prompt engineering
concepts and prompt tuning to get the output response you
need for the given input and ensure that each layer
functions as part of a cohesive system and the overall
system works optimally.
A design choice that has been used in the ShopAssist
project is the addition of a heuristic/ rule-based logic
for assigning scores to laptops based on the user’s
requirement.
As you can see in this image, there are three stages of the
chatbot, which are as follows:
● Stage 1: Intent Clarity and Intent Confirmation
● Stage 2: Product Extraction and Product Mapping
● Stage 3: Product Recommendation
Stage 1 - Intent Clarity and Intent Confirmation
The first stage involves a conversation between the user and the
AI system. Python functions such as initialize_conversation(),
trigger the conversation, and those such as
get_chat_completions() allows the conversation to continue with
each conversation via LLM calls.
The stage includes an additional layer called moderation_check()
to flag and discontinue conversations that contain unsafe or
sensitive content.
The images below shows the entire product mapping and product
information extraction for two sets of lap_spec variables.
Stage 3 - Product Recommendation
Unset
Variables extracted!
Chatbot Assistant:
Thank you for providing all the information. Kindly wait,
while I fetch the products:
User: exit