AI Chatbot Unit 2
AI Chatbot Unit 2
Customer Service-Centric Chatbots:The customer service process involves the exchange of private
customer information and accessing data sources to fetch current information. The information
exchange through the chatbot requires accuracy and the enforcement of strict security and privacy
policies. There are three critical considerations in chatbot development to achieve the intended use
case from a chatbot:
• Business context
• Policy compliance
• Security, authentication, and authorization
Business context: Business context refers to the peculiarities of the business the chatbot is
developed for. In general conversations, we can infer meanings to unsaid things or implicit things
in a conversation. The concept of live chat is still relevant in many large companies. The core
purpose of live chat was to reduce call center costs and provide another layer of conversation.
Policy compliance: Every conversation can lead to many types of requests to be fulfilled by
the chatbot.
For example, suppose a user wants to update his home address for his insurance. This,
from a technology perspective, can be as simple as passing the following information to the
chatbot (after authentication):
User: Update my home address to XYZ, sector-8,India
Chatbot: Address updated to XYZ, sector-8, India
Security, Authentication, and Authorization: Chatbots can be allowed to access private
information or remain on another channel to distribute public information conversationally.
Authenticating and authorization are two essential layers for securing a conversation. A secure
communication channel is vital to make sure the data exchanged between the user and the chatbot
is encrypted and transferred over a very secure medium.
In the below figure, the user first needs to establish the identity via the authentication
process. The authentication process generally involves providing a username and password, and
in multi-factor authentication, additional information like an OTP or PIN. The successful
authentication establishes the user identity as per system records. The next process is to establish
the permissions the user has in the system. Authorization is also called role management in
business terminology, and hence the business needs to assign roles/permissions for each
authenticated user before deployment of the chatbot.
Fig: Accountability Framework
Authorization is another essential layer in the accountability framework and it allows the
enterprise to control access to the resources. This also controls the access control layer where the
systems check what areas or functionality the authenticated user is allowed to access. This is very
important because multiple users will want to use the same source of information in multiple
independent conversations, and we want to protect the data and deliver only what the user is
authorized to access as per their role and policies.
Below figure shows how typical access is granted for an application; it’s valid for
chatbots as well. We can create a full, custom authentication and authorization service or use
third-party tools like AuthO, Active Directory, etc. In the shown approach, the application asks
the user for their credentials and sends them to the auth service. Once authenticated, it returns a
token with authorization details, which can be used by the chatbot to interact with the user.
Accuracy of User Input Translation to Systems:The chatbot logic creates an interface between
the user inputs in natural language and machine actionable inputs for retrieving information. This
interface needs to make sure that the translation is accurate before the output is delivered to the user.
This is the biggest challenge NLP-based chatbots face today, and hence one of the substantial
research areas. Let’s explain this with an example:
In this example, Input 1 and Input 2 need to get the same result from the system. The
chatbot logic needs to resolve for the two inputs before it can fetch the correct information for the
user. Here are the challenges and requirements of making sure the query gets accurate data for the
system to respond. If the chatbot logic is unable to create the right question, the results will not be
correct and may even cause unauthorized information to be shared with users unintentionally.
Chatbot Development Approaches: The chatbot development approach refers to how to build
the chatbot logic. The critical consideration in selecting the approach is the balance between natural
language abilities and accuracy of results.
Below figure shows, there is a general classification of chatbots based on their abilities and the
extent of AI built within them. The critical axis over which we classify chatbots is conversation scope
and machine responses.
our discussion is on closed domain conversations, where we can have either a rule-based
approach or create smart machines using an AI-based approach. In this section, we describe the
two popular types of development approaches.
Rules-Based Approach:The rules-based approach, also called the menu-driven approach, works
as an extension of self-help portals with a better experience. The critical difference is with the
navigation to solutions. In a self-help portal, you need to navigate to the right options manually,
while in menu-based chatbots, the navigation can be done using natural language and then actions
are performed using menus. Below figure shows menu driven chatbot interface.
These kinds of chatbots are prevalent and usually high in usage across industry use cases
that are integrated with CRM and other data systems.
Fig: Menu-driven chatbot interface
As shown in Figure, a chatbot attempts to understand the user question and then presents
a menu to choose the next action. The list makes sure the backend knows what exact operation
needs to be done to fulfill the request.
Advantages of the Menu-Based Approach:
There are some advantages to the menu-based approach:
• The accuracy of the response is confirmed by the design
• It’s based on heuristics rather than complicated NLP, and is easy to understand and
implement.
• It’s easy to extend to new menu items without retraining the core.
Disadvantages of the Menu-Based Approach With the advantage of excellent accuracy and
easy implementation, there come some limitations:
• The functionality is strictly limited to the templates’ code.
• The fulfillment is of two steps: understand the context and bring the menu up. After the
menu click, fulfill the request.
• It offers limited natural language conversations since the chatbot do not understand
beyond the coded situations.
AI-Based Approach: The AI-based approach is based on an advanced NLP engine to support
natural language and fulfill the request based on ML algorithms and system integration for
dynamic information retrieval. The accuracy of the chatbot is lower at the start and increases over
time. The critical difference between the menu-based and AI-based approach is the NLP engine.
An NLP engine is responsible for extracting the information present in the user input. Moreover,
based on the extracted information, the chatbot needs to decide the next steps.
As shown in Figure, the critical role of the NLP engine is to extract information from the
natural language input. The accuracy of the information extraction is critical because it will
decide the outcome of the conversation and be persisted in the system. The NLP engine needs to
extract the information required to instruct the system to act. In the menu-driven approach, the
user must engage with menus to select exact details before the system can act.
Fig: The NLP engine extracts exact information based on ML techniques
Advantages of the AI-Based Approach: The AI-based approach comes with many advantages
and customer-centric benefits:
• Advanced conversations can happen without the user going into multiple steps for actions.
• The NLP engine can deal with unseen scenarios and numerous texts.
• The chatbot can learn to create custom responses from scratch (natural language generation).
Disadvantages of the AI-Based Approach The problems of the AI-based approach are mostly
due to the complexity involved:
• The NLP engine is complex to train, maintain, and improve.
• The accuracy of responses suffers since the NLP output is not 100% correct.
• It requires a vast amount of data for a working chatbot NLP engine.
Conversational Flow: Chatbots for closed-domain applications are built with a defined purpose
and functionalities that the chatbot will provide as features to the user. Conversation flow is a
decision tree that describes the possible list of events, decisions, and outcomes of a conversation at
any point in the conversation. This type of flow secures higher relevance when the context needs to
be maintained and the response from the system is not a single step. An example of a conversation
flow is shown in Figure.
Utterance: Utterance refers to anything that user inputs to the chatbot. The full end-to-
End input makes an utterance, such as “Get me status of my order id 345,” “What is the
temperature today?,” “Hello,” “Good Morning,” etc.
Utterances are used to develop a classifier for intents in development. The chatbot stores
as many possible utterances in the database, which are the questions asked by the user, and
clusters them in different intents, which represent what the user wanted to say.
For developing a chatbot for insurance, we will need to capture actual questions asked by
users from different channels, such as chats, emails,office visits, customer value center, etc. We
will use all this historical data to train the chatbot to know the actual requirement of the user and
which conversational flow to use.
Intent: The intent is the intention of the user identified from the utterance captured by the
chatbot. Identifying intent is the essential function of a chatbot. In menu-driven chatbots, the
menus help the user to pinpoint the intent, while in AI-based chatbots, identifying intent is a task
done by the NLP engine.
The successful matching of intent decides the flow of conversation and delivers the
correct response to the user. In domain-specific chatbots, the intents could be different from
general intents, and hence domain-specific training is required.
For example, for the utterance of “Show me the stock price of Apple,” the intent is to find
the stock price. Let’s call this intent as showStockPrice. showStockPrice is the main intent of the
user, while the term “Apple” is the entity, also called a slot.
Entity: An entity can be defined as subordinate to the intent, which tells us the intent is related
to which subclass. In this example, “Apple” is the entity of @company_name for the intent
#showStockPrice.
Entities, or slots, when maintained in sessions, help retain the context of the conversation.
Channel: The channel is the medium used by the chatbot to connect with the user and fulfill
their request. Nowadays, all social media messengers allow chatbots for conversations (e.g.,
Facebook Messenger, Slack, Skype, etc.).
However, for an application like our 24x7 Insurance Agent, we want to have our
developed channel remain compliant with privacy laws and provide an added layer of security
when we access the private information of users.
Human Takeover: The human takeover is a term used to denote human fallback during
a conversation. Modern chatbots come with the feature of fallback to human assistance when the
chatbot fails to understand intents and extract entities, or the confidence is NLP output is low.
Human takeovers can be of two types:
1. A human takeover by choice: At any moment the user can choose to talk to a human,
maybe because they are more comfortable with humans or the chatbot isn’t solving their
issues.
2. A human takeover by confidence: A confidence filter may decide if we can fulfill the
request with high confidence; if not, the request is automatically transferred to a human
without a choice for the user. This provides a seamless experience for the user.
Use Case: 24x7 Insurance Agent: In this section, we will define the aspects for 24x7 Insurance
Agent, due to scope all features will not be explicitly implemented.
• Business context: The 24x7 Insurance Agent will be able to have necessary conversations in the
insurance domain. People may ask about their policies, premiums, etc.
• Policy compliance: The policies can be taken from the standard procedure followed at the customer
care center.
• Security, authentication, and authorization: We can create a PIN-based authorization, while an
IDS-based authentication can also be used if the users already have a product.
• Accuracy of user input translation to systems: To ensure this, we can create a confidence filter-
based human takeover mechanism.
• The AI-based approach or menu-based approach: Both should be fine as per need and balance
between flexibility and accuracy.
• Conversational flows: The flows must be created by sitting with the business and exploring its
policies.
• The NLP training will require data of old conversations, intent list, most frequent entities, etc.
These decisions will help the developer to select the right structure and
architecture for the chatbot solution.