0% found this document useful (0 votes)
3 views

Unit 4_Building and Deploying AI Applications.docx

Unit 4 focuses on building and deploying AI applications, particularly chatbots, using IBM Watson and IBM Watsonx. It covers the definitions, features, and capabilities of chatbots, including working with intents and entities, designing dialogs, and the practical steps to create chatbots. The document also highlights real-world applications, such as Domino's AI chatbot, and discusses ethical considerations and potential enhancements for chatbot capabilities.

Uploaded by

hayagreevkommu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit 4_Building and Deploying AI Applications.docx

Unit 4 focuses on building and deploying AI applications, particularly chatbots, using IBM Watson and IBM Watsonx. It covers the definitions, features, and capabilities of chatbots, including working with intents and entities, designing dialogs, and the practical steps to create chatbots. The document also highlights real-world applications, such as Domino's AI chatbot, and discusses ethical considerations and potential enhancements for chatbot capabilities.

Uploaded by

hayagreevkommu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Unit 4

Building and Deploying AI Applications


Table of Content

4.1 Building Chatbots: Introduction and Features


4.1.1 Introduction to Chatbots
4.1.2 Features of Chatbots

4.2 Creating Your Own Chatbots: IBM Watson and IBM Watsonx
4.2.1 Introduction to IBM Watson
4.2.2 Introduction to IBM Watsonx
4.2.3 Steps to Create a Basic Chatbot
4.2.4 Integrating IBM Watson with Your Chatbot
4.2.5 Features and Capabilities of IBM Watsonx

4.3 Working with Intents


4.3.1 Definition of Intents
4.3.2 Creating Intents
4.3.3 Training the Chatbot with Intents
4.3.4 Examples of Intents in Real-world Applications

4.4 Working with Entities


4.4.1 Definition of Entities
4.4.2 Creating Entities
4.4.3 Training the Chatbot with Entities
4.4.4 Examples of Entities in Real-world Applications

4.5 Creating Dialogs


4.5.1 Definition of Dialogs
4.5.2 Designing Dialog Flow
4.5.3 Implementing Dialogs in Chatbots
4.5.4 Testing and Debugging Dialogs

Unit 4 Building and Deploying AI Applications 1


By the end of this unit, you should be able to:
● Understand the definitions and features of chatbots and their significance in AI applications.
● Create your own chatbots using IBM Watson and IBM Watsonx, understanding their features
and capabilities.
● Work with intents and purposes in chatbots, including defining, creating, and training with
real-world examples.
● Work with entities in chatbots, including defining, creating, and training with real-world
examples.
● Design, implement, and test dialog flows in chatbots, ensuring effective communication and
interaction.

Opening Case: The AI Chatbot Transforming Domino's


Customer Experience

Domino's Pizza introduced Dom1, an


AI-powered chatbot, to revolutionize
the way customers place orders. This
chatbot, designed to interact through
text and voice commands, makes the
process of ordering pizza more
efficient and user-friendly. Dom is
equipped with the ability to
understand customer requests by
identifying specific tasks, or "intents,"
such as ordering pizza, tracking an
order, or finding a store. This
capability allows Dom to provide
precise and helpful responses,
ensuring customers have a smooth
experience.

The creation of these intents was a crucial step in developing Dom. Each intent represents a common
customer request, like "order pizza," "track order," or "find a store." By defining these intents, the
developers ensured that Dom could handle a wide range of interactions seamlessly. This structured
approach allows Dom to quickly and accurately understand what the customer wants and respond
appropriately, whether they are placing a new order or checking the status of an existing one.

Training Dom involved feeding it a large dataset of real customer interactions. This process helped
Dom learn to interpret various phrases and questions accurately. By analyzing these examples, Dom
became proficient at understanding different ways customers might phrase their requests. This
extensive training enabled Dom to handle real-world scenarios effectively, making it a reliable tool for
assisting customers with their pizza orders.

In practical use, Dom demonstrates its effectiveness by recognizing and responding to specific
customer intents. For example, when a customer wants to customize their pizza with different
toppings or apply a coupon to their order, Dom understands these requests and guides the customer

1
The AI Slice: Domino’s and Microsoft Transforming the Pizza Industry (111 Oct. 2023) bog by Dhanajay Garg from
medium.com

Unit 4 Building and Deploying AI Applications 2


through the process. This level of personalization enhances the user experience, making it easier for
customers to get exactly what they want without any confusion or delays.

Overall, Dom represents a significant advancement in customer service for Domino's Pizza. By
leveraging AI technology, Domino's has created a chatbot that not only simplifies the ordering process
but also adds a layer of personalization that improves customer satisfaction. Dom's ability to
understand and respond to various customer requests ensures that ordering pizza is a hassle-free
and enjoyable experience.

Discussion Questions
● Considering Dom collects and processes large amounts of customer data, what are the
ethical implications and potential risks regarding data privacy and security? Propose
strategies that Domino's could use to mitigate these risks.
● If Domino's wanted to expand Dom's capabilities to include personalized recommendations
based on previous orders, what additional data would be needed? Discuss the potential
benefits and drawbacks of this enhancement.

4.1 Building Chatbots: Introduction and Features


4.1.1 Introduction to Chatbots

Chatbots are digital tools designed to simulate conversation with human users. They are a form of
artificial intelligence (AI) that uses algorithms and machine learning techniques to interact with people
through text or voice. A chatbot can be as simple as a programmed script responding to specific
commands or as advanced as a conversational agent that learns from interactions to provide more
sophisticated responses. At their core, chatbots aim to automate communication and provide instant,
accurate responses to users’ questions or requests.

Industry Example:
A notable example of chatbots in action is Babylon Health, a healthcare service provider that uses
an AI-driven chatbot to assist patients. The chatbot asks users about their symptoms and provides
potential diagnoses based on a vast database of medical knowledge. This not only helps patients
get preliminary advice quickly but also reduces the strain on healthcare professionals by handling
routine queries. This chatbot serves as a first step for patients seeking medical advice and can
schedule appointments or guide users to appropriate services.

4.1.2 Features of Chatbots

1. Natural Language Processing (NLP):


Natural Language Processing (NLP) is a branch of AI that enables chatbots to understand and
generate human language. It involves several techniques, such as text analysis, sentiment detection,
and language generation. NLP allows chatbots to interpret user input, whether it’s a question,
command, or statement, and respond in a way that feels natural and conversational.

Industry Example:
An example of NLP in action is the Google Assistant. When users ask Google Assistant about the
weather, it interprets the question using NLP to understand that "weather" refers to current
conditions and "Google Assistant" translates that into a meaningful response. This technology allows

Unit 4 Building and Deploying AI Applications 3


users to interact with the assistant as if they were speaking to a person, making it easier to access
information or perform tasks.

NLP enhances the chatbot’s ability to understand diverse ways users might ask the same question
and generate responses that are contextually appropriate. This leads to more efficient and engaging
user interactions, making chatbots more useful in providing information, resolving issues, and offering
support.

2. Contextual Awareness:
Contextual awareness refers to a chatbot’s ability to remember the context of the conversation to
provide relevant responses. It involves tracking the flow of the conversation, understanding user
intent, and maintaining continuity in interactions. This feature helps chatbots avoid repetitive questions
and provide coherent responses based on previous exchanges.

Industry Example:
H&M’s chatbot on their mobile app demonstrates contextual awareness by keeping track of a user's
clothing preferences and past purchases. If a user asks for new outfits, the chatbot suggests items
based on their previous choices and preferences, creating a personalized shopping experience.

By maintaining conversation context, chatbots can handle more complex interactions, provide
personalized recommendations, and ensure that users have a smooth and satisfying experience. It’s
essential for chatbots to remember what has been said earlier to avoid confusion and improve the
overall effectiveness of the interaction.

3. Personalization:
Personalization allows chatbots to adapt their interactions based on individual user data. This feature
involves analyzing user history, preferences, and behavior to tailor responses and recommendations.
Personalized experiences make interactions more relevant and engaging for users.

Industry Example:
Sephora’s chatbot exemplifies personalization in the beauty industry. It offers beauty advice and
product recommendations based on users' past purchases, preferences, and even current beauty
trends. By analyzing user data, Sephora’s chatbot provides customized suggestions, making the
shopping experience more personal and enjoyable.

Personalization helps chatbots build a more meaningful connection with users by addressing their
specific needs and interests. This feature can lead to higher user satisfaction, increased engagement,
and better conversion rates for businesses.

4. Multi-Platform Integration:

Multi-platform integration allows chatbots to function across different platforms and devices, such as
websites, mobile apps, and social media. This feature ensures that users can interact with the chatbot
wherever they are, providing a consistent experience across various touchpoints.

Industry Example:

Unit 4 Building and Deploying AI Applications 4


Amazon’s Alexa for Shopping provides a seamless and consistent shopping experience across
multiple platforms. On the Amazon website, users can browse products, track orders, and manage
their accounts. The same shopping features are available on the mobile app, where users can also
access voice commands through the Alexa app for convenient ordering and order tracking.
Additionally, Amazon Echo devices allow users to make purchases, check order statuses, and
receive product recommendations through voice commands. This multi-platform integration ensures
that customers can engage with Amazon’s shopping services in a way that suits their preferences,
whether they are on a computer, mobile device, or using a voice assistant, offering a unified and
accessible shopping experience.

5. 24/7 Availability:

24/7 availability means that chatbots can operate around the clock without breaks. Unlike human
customer service representatives, chatbots do not require rest and can handle inquiries and provide
assistance at any time of day or night.

Industry Example:
KLM Royal Dutch Airlines’ chatbot offers 24/7 customer service to travelers. The chatbot helps with
booking flights, checking flight statuses, and answering questions about travel policies at any hour.
This continuous availability improves customer satisfaction by ensuring that help is always available.

The ability to offer round-the-clock service is crucial for businesses operating across different time
zones and for providing immediate support. It enhances customer service by ensuring that users can
get answers and assistance whenever they need it, without waiting for business hours.

By expanding on these features with relevant industry examples, students can better understand how
chatbots are built and deployed in real-world applications, and appreciate the significance of these
technologies in various sectors.

4.2 Creating Your Own Chatbots: IBM Watson and


IBM Watsonx
4.2.1 Introduction to IBM Watson

IBM Watson is a powerful suite of artificial intelligence tools and services developed by IBM.
Launched in 2011, Watson gained fame for its victory on the quiz show Jeopardy!, where it defeated
human champions. Since then, Watson has evolved into a comprehensive AI platform designed to
help businesses and organizations harness the power of AI to solve complex problems and streamline
operations. One notable example of IBM Watson's application is in healthcare, where it helps doctors
diagnose diseases. For instance, Watson for Oncology uses AI to analyze medical literature and
patient data to assist doctors in identifying the most effective treatment plans for cancer patients. By
leveraging Watson’s natural language processing capabilities, doctors can get recommendations
based on the latest research and case studies, leading to more personalized and effective treatment
options.

Unit 4 Building and Deploying AI Applications 5


4.2.2 Introduction to IBM Watsonx

IBM Watsonx is an advanced version of IBM Watson that extends the capabilities of the original
platform. Launched more recently, Watsonx focuses on providing more specialized and flexible AI
solutions. It integrates cutting-edge technologies such as machine learning, natural language
processing, and automated reasoning to build sophisticated AI applications. Watsonx aims to simplify
the development and deployment of AI models, making it easier for users to create customized
solutions. In the retail industry, Watsonx is used by companies like H&M to enhance the customer
shopping experience. By analyzing customer interactions and feedback, Watsonx helps H&M develop
chatbots and virtual assistants that can assist customers with product recommendations, inventory
inquiries, and more personalized shopping experiences. This leads to improved customer satisfaction
and increased sales.

4.2.3 Steps to Create a Chatbot Using IBM Watson and


IBM Watsonx

Creating a chatbot involves several key steps:

Define Your Chatbot’s Purpose: Start by deciding what you want your chatbot to do. For instance,
will it help customers find information, book appointments, or provide support? Clearly defining the
purpose will guide the design and functionality of your chatbot.

Design the Conversation Flow: Map out the interactions between users and the chatbot. This
includes defining common questions users might ask and the responses the chatbot will provide.
Tools like Watson Assistant provide visual interfaces to design and test these conversation flows.A
chatbot for a hotel might handle tasks like booking rooms, providing information about amenities, and
answering frequently asked questions. Designing conversation flows would involve creating dialogues
for these scenarios to ensure a smooth user experience.

Build the Chatbot: Use IBM Watson Assistant to create the chatbot. You will input the conversation
flows, set up intents (user goals), and define entities (specific pieces of information like dates or
locations). Watson Assistant offers pre-built templates and a drag-and-drop interface to simplify this
process. In the banking industry, a chatbot built with Watson Assistant can handle tasks like account
inquiries, transaction history checks, and report generation. The chatbot’s intents might include
“Check balance,” “Transfer funds,” and “Open new account,” with responses tailored to these
requests.

Train the Chatbot: Provide the chatbot with sample questions and answers to train it on how to
understand and respond to user inputs. This step is crucial for improving the chatbot’s accuracy and
effectiveness. A chatbot for an e-commerce platform might be trained with various product-related
queries, such as “Where is my order?” or “What are the return policies?” Training ensures that the
chatbot can handle these questions effectively.

Test and Refine: Before launching, test the chatbot to identify any issues or areas for improvement.
Collect feedback from users and make necessary adjustments to improve performance. A chatbot for
a university’s admissions office might be tested with prospective students to ensure it answers
questions about application deadlines, scholarship opportunities, and program details.

Deploy the Chatbot: Once testing is complete, deploy the chatbot to your chosen platform, whether
it’s a website, mobile app, or social media channel. A chatbot for a travel agency could be deployed

Unit 4 Building and Deploying AI Applications 6


on their website and Facebook page to assist users with travel bookings and provide support across
multiple channels.

Steps to Create a Chatbot with IBM Watson


1. Sign Up for IBM Cloud
➔ Visit: IBM Cloud
➔ Create an IBM Cloud account or log in if you already have one.
➔ Select the free tier or appropriate plan for your chatbot project.

2. Create a New IBM Watson Assistant Service


➔ Navigate to the IBM Watson Assistant Dashboard.
➔ Click on Create to start a new Watson Assistant service instance.
➔ Select a plan: You can start with the Lite plan for free, which includes basic features and
usage.

3. Set Up Your Watson Assistant


➔ Open the Watson Assistant service from your IBM Cloud dashboard.
➔ Click on Launch Watson Assistant to enter the Assistant interface.

4. Create a New Assistant


➔ Click on Create an Assistant.
➔ Enter a name for your assistant and a description.
➔ Click on Create to set up the assistant.

5. Create a Dialog Skill


➔ In the Assistant dashboard, click on Add a Dialog Skill.
➔ Choose to create a new skill.
➔ Select a template or start from scratch. You can also import a skill from a template library.

6. Define Intents
➔ Navigate to the Intents section in the Dialog Skill.
➔ Click on Create Intent.
➔ Enter the name and description for your intent.
➔ Add example user phrases that express this intent (e.g., “I want to check my balance”).

Example:
➔ Intent Name: CheckBalance
➔ Example Phrases: “What is my balance?”, “Show me my account balance.”

7. Define Entities
➔ Navigate to the Entities section.
➔ Click on Create Entity.
➔ Enter the name and description for the entity.
➔ Define entity values and synonyms that your chatbot can recognize.

Example:
➔ Entity Name: AccountType
➔ Values: “Savings”, “Checking”, “Credit”

Unit 4 Building and Deploying AI Applications 7


8. Design Dialogs
➔ Go to the Dialog section.
➔ Click on Add Node to create conversation paths.
➔ Define conversation flows by adding conditions based on intents and entities.
➔ Set Up responses that the chatbot will provide based on user inputs.

Example:
➔ Dialog Node: Check balance
➔ Condition: CheckBalance
➔ Response: “I can help with that. Which account’s balance would you like to check?”

9. Train Your Chatbot


➔ Click on Train in the Dialog Skill section.
➔ Ensure that the chatbot learns from user inputs and improves accuracy over time.
➔ Test the chatbot to verify that intents, entities, and dialogs work as expected.

Example:
Test Query: “What is my savings account balance?”

10. Integrate Your Chatbot


➔ Navigate to the Integrations section.
➔ Choose an integration channel (e.g., web chat, Slack, Facebook Messenger).
➔ Follow the instructions to set up and configure the chosen integration.

Example:
➔ Channel: Web Chat
➔ Integration Code: Copy and embed the provided JavaScript code into your website.

11. Deploy Your Chatbot


➔ Go to the Deployment section in the IBM Watson Assistant dashboard.
➔ Configure deployment settings and review the chatbot’s performance.
➔ Publish the chatbot to make it live for users.

Steps to Create a Chatbot with IBM Watsonx


1. Set Up an IBM Cloud Account

● Create an Account
➔ Visit the IBM Cloud website and sign up for a free account.
● Access Watsonx Services
➔ After logging in, go to the IBM Cloud dashboard and search for “Watsonx” to access
the Watsonx suite of AI tools.

2. Create and Launch a New Watsonx Chatbot Project

● Navigate to Watsonx Assistant


➔ From the IBM Cloud dashboard, click on "Catalog" and search for "Watson Assistant".
Select it from the list of available services.
● Create a New Assistant
➔ Click on "Create" to set up a new instance of Watson Assistant. Choose a plan that
fits your needs (there is a Lite plan for free).

Unit 4 Building and Deploying AI Applications 8


● Configure Your Assistant Instance
➔ Name your service instance and choose the appropriate region for deployment.
Review and confirm your choices.

● Launch Your New Assistant


➔ Click "Launch Watson Assistant":
➔ After creating your instance, click on "Launch Watson Assistant" to enter the main
workspace where you can start building your chatbot.

● Create a New Assistant:


➔ Click on "Create Assistant" to start a new chatbot project within the Watson Assistant
tool. Provide a name and description for your assistant.

● Choose the Assistant Type:


➔ Select “Blank Assistant” or use a “Starter Template” if you want to begin with a
predefined set of intents and dialogs.

3. Define Your Conversation

● Create Your Conversation: Step 1


➔ Define the Conversation Goal
➔ In the “Create Your Conversation” section, start by defining the main goal of your
chatbot. Decide what kind of interactions it will handle (e.g., customer support, FAQs,
order processing).

● Create Your Conversation: Step 2


➔ Set Up Conversation Paths
➔ Define the paths for user interactions by creating conversation stages:
➔ Welcome Message: Set up an initial greeting for users.
➔ User Queries: Define sample user questions or statements that the chatbot will
recognize.
➔ Bot Responses: Set up automated responses that the chatbot will provide based on
user input.

● Define User Responses


➔ Add Responses: For each user query, add corresponding responses. You can use
predefined templates or create custom messages that will guide the conversation.

● Preview Your Chatbot


➔ Test Conversations: Use the “Preview” feature to simulate interactions with your
chatbot. Test different user inputs to see how the chatbot responds and make
adjustments as needed.

4. Refine and Improve Your Chatbot

● Monitor Interaction Analytics


➔ Review Analytics: Access analytics to review how users are interacting with your
chatbot. Look for common queries, frequent issues, and user satisfaction metrics.

Unit 4 Building and Deploying AI Applications 9


● Update Responses and Paths
➔ Refine Conversations: Based on analytics, refine conversation paths and update
responses to improve chatbot performance.

● Implement Feedback
➔ Adjust Based on User Feedback: Use feedback from users and analytics data to
make necessary adjustments to conversation flows and responses.

5. Deploy Your Chatbot

● Configure Deployment Options


➔ Choose Deployment Channels: Select how you want to deploy your chatbot.
Watsonx allows integration with websites, mobile apps, and messaging platforms.

● Publish Your Chatbot


➔ Make it Live: Finalize all configurations and publish your chatbot to make it available
for users through your selected channels.

4.2.4 Features and Capabilities of IBM Watsonx


IBM Watsonx offers a range of advanced features and capabilities that make it a powerful tool for
creating AI applications:

Enhanced AI Model Building: Watsonx provides advanced tools for building and training AI models,
including automated machine learning (AutoML), which simplifies the process of model creation and
selection. In the insurance industry, Watsonx’s AutoML capabilities can be used to develop predictive
models for assessing risk, setting premiums, and detecting fraudulent claims.

Natural Language Understanding: Watsonx has advanced natural language processing (NLP)
capabilities that allow it to understand and interpret human language with greater accuracy. A chatbot
developed for a healthcare provider using Watsonx can understand complex medical terms and
provide accurate information about symptoms, treatments, and medication options.

Integration with Other Tools: Watsonx integrates with various IBM tools and third-party applications,
making it easy to connect your chatbot with other systems like CRM platforms, analytics tools, and
data sources. In the customer service sector, a Watsonx-based chatbot can integrate with CRM
systems to pull up customer information, track support tickets, and provide personalized service
based on user history.

Scalability: Watsonx is designed to scale easily, allowing businesses to expand their chatbot’s
capabilities and handle increased user interactions without performance issues. For a global
e-commerce company, Watsonx can scale its chatbot to handle interactions across multiple
languages and regions, providing consistent customer support worldwide.

Advanced Analytics: Watsonx offers sophisticated analytics features to track chatbot performance,
analyze user interactions, and derive insights for continuous improvement. In the education sector,
Watsonx can be used to analyze student interactions with a chatbot for academic support, helping
educators identify common issues and areas where students might need additional resources.

By understanding these features and capabilities, students can appreciate how powerful tools like IBM
Watson and Watsonx are in creating practical AI applications that solve real-world problems.

Unit 4 Building and Deploying AI Applications 10


4.3 Working with Intents
4.3.1 Definition of Intents

In the realm of chatbots and artificial intelligence, an "intent" represents a user’s goal or purpose
behind their interaction with the chatbot. It is the underlying meaning or request that the user wants to
convey through their message. Think of intents as categories or labels that help the chatbot
understand what the user wants to achieve, whether it’s asking a question, making a purchase, or
seeking assistance.

Intents are essential for chatbots to function effectively. They allow the system to interpret the user's
input accurately and provide relevant responses. For example, when a user sends a message, the
chatbot analyzes the text to determine the intent. This process involves natural language processing
(NLP) techniques that break down the message into understandable components.

By identifying the intent, the chatbot can map the user's input to a specific action or response. This is
crucial for creating a seamless and intuitive user experience. Without intents, chatbots would struggle
to understand and fulfill user requests, leading to frustration and inefficiency.

Imagine you are using a customer service chatbot for an online store. When you type "I want to return
a product," the intent here is to get information about the return process. On the other hand, if you say
"I have a question about my order," the intent is to inquire about order details. Intents help the chatbot
classify these messages and respond appropriately.

Example 1:
Consider a customer interacting with a travel booking chatbot. The user might send messages such
as:

"Book a flight to New York"


"Show me hotels in Paris"
"I need to cancel my reservation"

Each of these messages represents a different intent:

"Book a flight to New York" indicates the intent to make a flight booking.
"Show me hotels in Paris" shows the intent to browse hotel options.
"I need to cancel my reservation" signifies the intent to cancel an existing booking.
By accurately identifying these intents, the chatbot can take appropriate actions, such as searching
for flights, displaying hotel listings, or processing a cancellation.

Example 2:
Consider a popular e-commerce platform like Amazon. When users interact with Alexa to shop, they
might say things like "Add a laptop to my cart" or "What’s the status of my order?" Each of these
phrases represents different intents. "Add a laptop to my cart" indicates the intent to make a
purchase, while "What’s the status of my order?" shows the intent to get order details. By identifying
these intents, Alexa can handle various tasks like adding items to the cart or checking order status.

Unit 4 Building and Deploying AI Applications 11


Example 3:
In the banking sector, chatbots are increasingly used to assist customers with various services. For
instance:

"Transfer $500 to my savings account" reflects the intent to perform a bank transfer.
"What’s my account balance?" indicates the intent to check the account balance.
"Help me reset my password" shows the intent to get assistance with password recovery.
By recognizing these intents, banking chatbots can execute transactions, provide account
information, and offer technical support, enhancing the overall customer experience.

Understanding and defining intents is fundamental for the development and operation of effective
chatbots. By categorizing user inputs into specific intents, chatbots can deliver precise and relevant
responses, thereby improving user satisfaction and efficiency. Whether in customer service,
e-commerce, travel, or banking, intents play a crucial role in enabling chatbots to perform diverse
tasks and handle various user requests seamlessly.
4.3.2 Creating Intents
Creating intents involves defining specific user goals or actions that the chatbot needs to recognize
and handle. This process includes identifying common phrases or questions users might ask and
grouping them under corresponding intents. It is like setting up a framework for the chatbot to
understand different user needs and provide suitable responses.

Intents are essentially the categories or labels that represent what a user wants to do. For example, in
a customer service chatbot, intents could range from "Reset Password" to "Check Order Status" or
"Schedule Appointment." Each intent needs to be well-defined and associated with various phrases
that users might use to express the same need or goal. This allows the chatbot to accurately
understand and respond to diverse user inputs.

Steps to Create Intents:

● Identify User Needs: Begin by understanding what users might want to achieve through the
chatbot. This can be done through user research, surveys, or analyzing previous interactions
if available. By identifying the primary purposes users will interact with the chatbot, you can
determine the intents that need to be created. For example, if the chatbot is for a retail
website, common user needs might include finding products, checking order status, returning
items, or getting help with account issues.

● Define Intents: Create distinct intents based on common user goals. Each intent should be
clear and focused on a single user action or query. For example, intents for a restaurant
chatbot might include:
➔ “Make a Reservation”
➔ “View Menu”
➔ “Order Food”
➔ “Ask for Directions”
➔ “Inquire about Specials”

Each intent should be accompanied by a concise description that outlines what the intent covers.

● Create Training Data: For each intent, gather phrases or sentences that users might say.
This training data helps the chatbot learn to recognize the intent behind various user inputs.

Unit 4 Building and Deploying AI Applications 12


For the “Make a Reservation” intent, phrases could include:
➔ “I’d like to book a table”
➔ “Reserve a table for two”
➔ “Can I get a table for tonight?”
➔ “I need a dinner reservation”
➔ “Book a table for tomorrow night”

The more varied and comprehensive the training data, the better the chatbot will be at understanding
different ways users might express the same intent.

● Organize and Refine Intents: Continuously refine the intents and training data based on
user interactions. If the chatbot frequently misinterprets a certain phrase, it may indicate that
the intent definitions or training data need adjustments. Regularly update the chatbot with new
phrases as more user interactions are analyzed to improve its accuracy and performance.

Example:
Consider the example of a banking chatbot like Erica, used by Bank of America. To create intents for
Erica, developers might start by identifying the key services that customers frequently use and want
to perform through the chatbot. These services could include checking account balances,
transferring funds, finding branch locations, and paying bills.

● Identify User Needs:


Through user research and analysis of past interactions, developers might find that customers often
inquire about their account balances, want to transfer money, look for the nearest bank branch, or
need help with bill payments.

● Define Intents:
We can define specific intents such as:
➔ “Check Account Balance”
➔ “Transfer Funds”
➔ “Find Branch Locations”
➔ “Pay Bills”

Each of these intents would represent a distinct user goal or action that the chatbot needs to handle.

● Create Training Data:


For the “Check Account Balance” intent, training data could include phrases like:
➔ “What’s my current balance?”
➔ “Show me my account balance”
➔ “How much money do I have?”
➔ “Check my savings account balance”
➔ “What’s in my checking account?”

Similarly, for the “Transfer Funds” intent, phrases could include:


➔ “Send money to my savings account”
➔ “Transfer $50 to my checking account”
➔ “Move money between accounts”
➔ “How do I transfer funds?”

Unit 4 Building and Deploying AI Applications 13


➔ “Can you help me transfer money?”

By following these steps, it can be ensured that the chatbot can accurately understand and respond
to a wide range of user inputs, enhancing the user experience and making the chatbot a valuable
tool for customers.

4.3.3 Training the Chatbot with Intents


Training a chatbot with ‘intents’ is a crucial step in developing an effective and responsive AI system.
Intents represent the goals or purposes behind a user's message, and training involves teaching the
chatbot to recognize these intents accurately. This process helps the chatbot understand what the
user wants to achieve and respond appropriately, much like teaching a student to match questions
with the correct answers.

Training Process:

● Provide Example Phrases:


Example phrases are varied user inputs that correspond to a specific intent. These phrases help the
chatbot learn the different ways users might express the same intent.

For each intent, input a diverse set of phrases that users might say. For instance, for the "Order Food"
intent, include phrases like:

➔ “I want to order pizza.”


➔ “Can I get a burger?”
➔ “I’d like to place an order.”
➔ “Can you get me sushi?”
➔ “I need to order food.”

● Train the Model:

Training the model involves using the provided example phrases to teach the chatbot’s natural
language processing (NLP) system. The model learns to identify patterns and relationships between
the user’s input and the corresponding intent. Utilize machine learning algorithms to process the
example phrases. The model analyzes the language used in these phrases to understand how to
categorize new, unseen inputs accurately.

● Test and Refine:


Testing involves evaluating the chatbot’s performance with new phrases to ensure it correctly
identifies intents. This step ensures the chatbot’s responses are accurate and reliable.
➔ Testing: Input new, unseen phrases to see if the chatbot can correctly identify the intent.
➔ Refining: Based on the results, refine the intents by adding more examples or adjusting the
existing ones.This iterative process continues until the chatbot performs well with a high
degree of accuracy.

Unit 4 Building and Deploying AI Applications 14


Example:
Consider the training process for a virtual assistant like Google Assistant. To handle various intents,
such as the “Set an Alarm” intent, the assistant needs to recognize a range of user inputs.

For example: Intent: Set an Alarm

Example Phrases:
➔ “Wake me up at 7 AM.”
➔ “Set an alarm for 6:30.”
➔ “I need to get up at 5 tomorrow.”
➔ “Can you set an alarm for 8 in the morning?”
➔ “Remind me to wake up at 6.”

One can provide a comprehensive set of example phrases for each intent. The assistant is trained to
understand these phrases through extensive data processing and machine learning techniques.
Over time, with continuous user interactions, the model is refined to improve its accuracy and
responsiveness. As users interact with the assistant and provide feedback, developers continuously
update the example phrases and retrain the model to handle new variations and ensure the system
remains effective and user-friendly.

4.3.4 Examples of Intents in Real-World Applications

Intents are used in a wide range of real-world applications to enhance user experiences by
understanding and responding to different needs. Here are some examples across various industries:

● Healthcare:
Intent: “Schedule Appointment”
Example: A chatbot on a hospital’s website might recognize the intent “Schedule Appointment” when
a user says, “I need to book a doctor’s appointment” or “When can I see a specialist?”

● Travel and Hospitality:


Intent: “Book a Flight”
Example: A travel booking chatbot might handle the intent “Book a Flight” with phrases like “Find me
a flight to New York” or “I want to book a flight for next month.”

● Entertainment:
Intent: “Play Music”
Example: Music streaming services like Spotify use intents such as “Play Music” where users can
say, “Play my favorite playlist” or “Play the latest album from Taylor Swift.”

● Education:
Intent: “Submit Assignment”
Example: An educational chatbot might support the intent “Submit Assignment” with messages like
“How do I upload my homework?” or “Submit my English essay.”

Unit 4 Building and Deploying AI Applications 15


4.4 Working with Entities
4.4.1 Definition of Entities
Entities are crucial components in the realm of chatbot development and natural language processing
(NLP). They are specific pieces of information that a chatbot must identify and understand to
accurately interpret and respond to user inputs. These entities can be thought of as key data points or
objects within a conversation that carry significant meaning and relevance. Key roles of Entities in
Chatbots are as below:

● Entities help the chatbot to:

➔ Extract important details from user messages.


➔ Provide more precise and contextual responses.
➔ Facilitate more dynamic and interactive conversations.

By identifying and understanding entities, a chatbot can fill in the necessary details required to
complete a task or provide a service. This capability is fundamental to creating a seamless and
effective user experience.

● Types of Entities
Entities can be classified into several categories, depending on the application and context of the
chatbot. Common types include:

➔ Numerical Entities: Numbers, quantities, dates, and times.


➔ Textual Entities: Names of people, locations, organizations, products, etc.
➔ Categorical Entities: Types or classes of items, such as types of cuisine, genres of movies,
etc.
➔ Boolean Entities: Simple true/false or yes/no values.

Examples of Entities
To better understand the concept, let’s explore some examples in different chatbot scenarios:

● Travel Booking Chatbot:

➔ Location: Destination city or airport.


➔ Date: Departure and return dates.
➔ Travel Type: Mode of travel such as flight, train, or bus.

● E-commerce Chatbot:

➔ Product Name: Specific item the user is looking for.


➔ Price Range: Budget or price limits.
➔ Brand: Preferred brand of products.

● Healthcare Chatbot:

➔ Symptom: Descriptions of symptoms.


➔ Appointment Date: Desired date and time for an appointment.
➔ Doctor's Specialty: Type of doctor or specialist needed.

Unit 4 Building and Deploying AI Applications 16


● Restaurant Reservation Chatbot:

➔ Restaurant Name: Name of the restaurant.


➔ Reservation Date and Time: When the reservation is to be made.
➔ Number of Guests: How many people will be dining.
➔ Special Requests: Dietary preferences, seating arrangements, etc.

Example:
Let’s consider a detailed example involving a restaurant reservation chatbot:

Scenario: Restaurant Reservation


A user wants to book a table at a restaurant. The chatbot needs to extract several entities to process
this request effectively:

Restaurant Name: "Chez Gourmet"


Helps the chatbot identify which restaurant the user wants to book a table at.

Reservation Date and Time: "July 21, 2024, at 7:00 PM"


Ensures the chatbot understands when the reservation is needed.

Number of Guests: "4 people"


Allows the chatbot to know how many seats to reserve.

Special Requests: "Window seat, vegetarian meal options"


Helps the chatbot accommodate specific user preferences or requirements.

By identifying these entities, the chatbot can perform the following actions:

Check Availability: Verify if there are tables available at "Chez Gourmet" on the specified date and
time for 4 guests.
Confirm Details: Ensure the reservation details align with the restaurant's availability and policies.
Provide Confirmation: Respond to the user with a confirmation of their reservation, including any
special requests.

Let’s say the preview of conversation will look like :

User: "I’d like to book a table at Chez Gourmet for four people on July 21st at 7 PM. Can we get a
window seat and do you have vegetarian meal options?"

Chatbot:
● Entities Extracted:
➔ Restaurant Name: "Chez Gourmet"
➔ Reservation Date and Time: "July 21, 2024, at 7:00 PM"
➔ Number of Guests: "4 people"
➔ Special Requests: "Window seat, vegetarian meal options"

● Response: "Sure, let me check the availability. We have a table for 4 available at 7 PM on
July 21st at Chez Gourmet. I've noted your request for a window seat and vegetarian meal
options. Your reservation is confirmed!"

Unit 4 Building and Deploying AI Applications 17


Entities play an indispensable role in chatbot functionality, enabling the extraction of relevant
information from user inputs. This allows chatbots to perform tasks accurately and provide
personalized and contextually appropriate responses. Understanding and defining entities effectively
is crucial in developing intelligent and responsive chatbot systems.

4.4.2 Creating Entities


Creating entities involves identifying and defining these key pieces of information that the chatbot will
recognize and respond to. This process includes specifying the type of data (such as names, dates, or
numbers) and providing examples of how these entities might appear in user input.

● Steps to Create Entities:

➔ Identify Relevant Data Points: Determine what information is crucial for the chatbot to
understand the user's needs.
➔ Define Entity Types: Categorize these data points into specific entity types (e.g., location,
date, product).
➔ Provide Examples: Supply the chatbot with various examples of how these entities might be
mentioned in conversations.

Example:
For an e-commerce chatbot, entity types might include product categories (e.g., electronics, clothing),
brand names, and payment methods.

4.4.3 Training the Chatbot with Entities


Training the chatbot with entities involves teaching the AI to recognize and extract these entities from
user inputs. This process usually requires providing the chatbot with annotated training data, where
the entities are labeled within sample sentences. The chatbot uses this data to learn patterns and
improve its entity recognition capabilities.

Steps to Train the Chatbot:

➔ Annotate Training Data: Label entities within sample user inputs.


➔ Use Machine Learning Models: Apply models that can learn to identify and extract these
entities from new inputs.
➔ Test and Refine: Continuously test the chatbot's performance and refine the training data as
needed.

Example:
For a customer service chatbot, training might involve labeling entities such as order numbers,
product names, and issue types in historical customer service logs.

4.4.4 Examples of Entities in Real-world Applications

● Healthcare Chatbots:

Entities: Symptoms, medication names, appointment dates.


Example: A chatbot assisting patients can identify symptoms mentioned by the user and suggest
possible conditions or recommend booking an appointment.

Unit 4 Building and Deploying AI Applications 18


● Banking and Finance Chatbots:

Entities: Account types, transaction amounts, dates.


Example: A banking chatbot can recognize when a user mentions "transferring $500 to savings" and
process the transaction accordingly.

● Travel Booking Chatbots:

Entities: Destinations, travel dates, accommodation types.


Example: A travel chatbot can understand a user asking for "flights to New York next Monday" and
provide relevant booking options.

● E-commerce Chatbots:

Entities: Product names, quantities, shipping options.


Example: An e-commerce chatbot can assist users by recognizing "I need two pairs of running
shoes" and add the items to the cart, asking for preferred shipping options.

By understanding and effectively working with entities, chatbots can provide more accurate and
context-aware responses, enhancing user interactions and making the AI application more useful and
efficient in real-world scenarios.

Theory to Practice
● Analyze how entities differ from intents in a chatbot. How do entities contribute to
understanding user inputs?
● Design a strategy for creating entities that can handle multiple variations of user inputs.
How would you ensure that your entity definitions are robust and flexible?
● Create a set of entities for a chatbot designed to book hotel reservations. Explain how each
entity will be used to improve the chatbot's functionality.

4.5 Creating Dialogs


Creating dialogs in AI applications, especially chatbots, involves defining how the system interacts
with users. This process ensures that users have a seamless and meaningful experience while
interacting with the chatbot.

4.5.1 Definition of Dialogs


Dialogs are the interactive exchanges between a user and a chatbot, forming the backbone of
conversational interfaces. Each dialog consists of multiple turns, where a turn is defined as one user
input followed by one corresponding response from the chatbot. These exchanges are essential for
guiding users through specific tasks, providing information, or assisting with inquiries, ensuring a
seamless and efficient user experience.

Structure of Dialogs
➔ User Input: This is the message or query entered by the user. It can range from simple
commands to complex sentences, depending on the user's needs and the chatbot's
capabilities.

Unit 4 Building and Deploying AI Applications 19


➔ Chatbot Response: This is the reply generated by the chatbot based on the user's input. The
response can provide information, ask follow-up questions, or guide the user through a
process.

Components of Effective Dialogs


➔ Intent Recognition: Understanding the user's intention behind their input.
➔ Entity Extraction: Identifying specific pieces of information within the user input.
➔ Context Management: Keeping track of the conversation's context to provide relevant and
coherent responses.
➔ Flow Control: Managing the direction and progression of the dialog to achieve the desired
outcome.

Purpose and Benefits of Dialogs


➔ Task Completion: Dialogs facilitate the completion of specific tasks, such as booking a ticket,
ordering food, or troubleshooting a problem.
➔ Information Retrieval: They help users find information quickly by responding to queries with
accurate and relevant answers.
➔ User Assistance: Dialogs provide step-by-step guidance, making it easier for users to
navigate through complex processes or resolve issues.

Example:

In customer support chatbots like those used by Amazon, dialogs play a crucial role in enhancing
the customer service experience. These chatbots can assist users in various ways:

➔ Order Tracking: By asking for order details, the chatbot can provide real-time updates on
the status of a user's shipment.
➔ Processing Returns: The chatbot can guide users through the return process by asking for
the reason for return and providing instructions on how to proceed.
➔ Finding Product Information: Users can inquire about product specifications, availability,
or pricing, and the chatbot can respond with the necessary information.

For instance, if a user wants to track their order, the dialog might go as follows:

➔ User Input: "Can you help me track my order?"


➔ Chatbot Response: "Sure! Please provide your order number."
➔ User Input: "It's 123456."
➔ Chatbot Response: "Thank you. Your order is currently out for delivery and should arrive by
5 PM today."

In this example, the dialog involves a series of turns where the chatbot effectively collects the
necessary information and provides a helpful response, illustrating the importance of well-structured
dialogs in delivering efficient and satisfying user experiences.

Designing Effective Dialogs


➔ User-Centric Approach: Dialogs should be designed with the user's needs in mind,
ensuring clarity, relevance, and ease of use.

Unit 4 Building and Deploying AI Applications 20


➔ Error Handling: Anticipate possible misunderstandings or errors and design responses that
can guide users back on track.
➔ Personalization: Incorporate user data to make interactions more personalized and
engaging.
➔ Continuous Improvement: Regularly update and refine dialogs based on user feedback
and interaction data to enhance performance.

Dialogs are the foundation of meaningful interactions between users and chatbots, enabling smooth
and productive conversations that cater to various needs and tasks. By focusing on intent
recognition, context management, and user-centric design, dialogs can significantly enhance the
effectiveness and user satisfaction of chatbot applications.

4.5.2 Designing Dialog Flow


Dialog flow is the blueprint of how conversations will progress in a chatbot or virtual assistant. It
includes the structure and sequence of interactions to ensure a natural and logical flow. Effective
dialog flow design involves understanding user intents, managing context, and handling unexpected
inputs gracefully. Here's a more detailed look at the elements involved in designing dialog flow:

1. Understanding User Intents:


User intents are the goals or purposes behind user inputs. Recognizing these intents accurately is
crucial for the chatbot to provide relevant responses. To design a successful dialog flow:

➔ Identify Common Intents: Determine the most common tasks or questions users will have.
For instance, in a banking chatbot, these might include checking account balances,
transferring money, or finding the nearest ATM.
➔ Create Intent Hierarchies: Group related intents together to streamline the conversation and
make it easier to handle multiple user requests within a single interaction.
➔ Anticipate User Behavior: Consider how users might phrase their requests differently and
include variations of intents to cover a wide range of inputs.

2. Structuring Interactions:
The structure of the conversation should guide users naturally from one step to the next, ensuring
they can accomplish their goals efficiently:

➔ Welcome Messages: Start with a friendly greeting and an introduction to the chatbot's
capabilities.
➔ Clarifying Questions: Ask clarifying questions if the user's intent is unclear. For example, if a
user asks about "balance," the chatbot might respond with, "Are you asking about your
account balance?"
➔ Actionable Steps: Break down complex tasks into smaller, manageable steps. For instance,
transferring money might involve asking for the amount, the recipient's details, and
confirmation.
➔ Confirmation and Follow-up: Confirm actions before execution and provide follow-up
messages to ensure the user is satisfied with the outcome.

3. Managing Context:
Context management is vital to maintaining a coherent conversation, especially in multi-turn dialogs:

➔ Context Persistence: Keep track of the conversation's context to understand and remember
previous interactions. This helps in responding appropriately to follow-up questions.

Unit 4 Building and Deploying AI Applications 21


➔ Contextual Responses: Tailor responses based on the context. For example, if a user has
already mentioned their account type, the chatbot shouldn't ask for this information again.
➔ Seamless Context Switching: Allow users to switch topics or intents smoothly without losing
the current context. If a user asks to transfer money while inquiring about their balance, the
chatbot should handle this transition gracefully.

4. Handling Unexpected Inputs:


No matter how well-designed a dialog flow is, users will occasionally provide unexpected inputs:

➔ Fallback Responses: Prepare generic fallback responses for unrecognized inputs, such as,
"I'm sorry, I didn't understand that. Could you please rephrase it ?"
➔ Error Recovery: Guide users back on track by providing options or asking clarifying
questions. For instance, if a user types something ambiguous, the chatbot might ask, "Are
you looking for information on your account or help with a transaction?"
➔ User Education: Include tips or suggestions to help users understand how to interact with
the chatbot effectively.

Example: Bank of America’s Erica


Bank of America’s Erica is an exemplary case of a well-designed dialog flow. Erica helps customers
with various banking tasks such as checking account balances, transferring money, and paying bills.

The dialog flow in Erica's system ensures that:


➔ User Goals are Met Efficiently: Users can achieve their goals without confusion. For
instance, if a user wants to transfer money, Erica will guide them through the steps
seamlessly.
➔ Context is Managed Effectively: Erica remembers details from the conversation, so users
don't need to repeat themselves. If a user checks their balance and then decides to transfer
money, Erica retains the necessary context.
➔ Unexpected Inputs are Handled Gracefully: If a user asks an unrelated question or
makes an ambiguous request, Erica can provide a helpful response or redirect the
conversation appropriately.

By focusing on these elements, you can design a dialog flow that provides a smooth, intuitive, and
efficient user experience, similar to the success seen with Bank of America’s Erica.

4.5.3 Implementing Dialogs in Chatbots


Implementing dialogs in chatbots is a crucial step that involves coding the conversation logic into the
chatbot platform. This process ensures that the chatbot can understand and respond to user inputs
accurately, creating a smooth and interactive experience for users. Here are the detailed steps
involved in implementing dialogs:

● Defining Intents
Intents represent the purpose or goal behind a user's input. To implement dialogs effectively, it's
essential to define a comprehensive set of intents that cover the range of interactions users might
have with the chatbot. For example, intents for a customer service chatbot might include "Check
Order Status," "Return a Product," or "Find a Store."

Unit 4 Building and Deploying AI Applications 22


● Defining Entities
Entities are specific pieces of information that the chatbot needs to extract from user input to
understand and respond appropriately. Entities can be dates, times, locations, names, product types,
etc. For instance, in the intent "Book a Flight," entities might include "destination," "departure date,"
and "return date."

● Crafting Responses
Responses are the messages the chatbot sends back to the user. These should be well-crafted to be
clear, informative, and engaging. Responses can be simple text messages, but they can also include
images, buttons, or other interactive elements to enhance the user experience.

● Using Dialog Management Frameworks


Most chatbot development platforms provide dialog management frameworks or tools to streamline
the implementation process. These frameworks help manage the flow of conversation, handle user
inputs, and generate appropriate responses. Popular platforms include:

➔ IBM Watson Assistant: Offers a robust dialog management system that allows developers to
create complex conversation flows with ease. It provides tools for defining intents, entities,
and dialog nodes, which represent the steps in a conversation.
➔ Google Dialog Flow: Utilizes machine learning to understand user input and manage dialog
flows. It supports integration with various messaging platforms and provides pre-built agents
to simplify the development process.
➔ Microsoft Bot Framework: Provides a comprehensive suite of tools for building, testing, and
deploying chatbots. It includes features for dialog management, natural language
understanding, and multi-channel integration.

Example: Sephora’s Virtual Artist Chatbot


A practical example of implementing dialogs can be seen in Sephora’s Virtual Artist chatbot. This
chatbot helps customers find makeup products, provides virtual try-ons, and offers beauty tips.

Here's how dialogs are implemented in this context:

➔ Defining Intents: The chatbot has intents such as "Find Makeup Product," "Try On
Virtually," and "Get Beauty Tips."
➔ Defining Entities: Entities might include "product type" (e.g., lipstick, eyeshadow), "color
preferences," and "skin tone."
➔ Crafting Responses: Responses are tailored to guide users through product selection. For
example, if a user wants to try on lipstick, the chatbot might respond with, "Sure! What color
are you interested in?"
➔ Using Dialog Management: The chatbot uses a dialog management framework to handle
the flow of conversation. When a user expresses interest in a product, the chatbot asks
relevant questions, processes the inputs, and provides recommendations.
➔ Test and Refine: Conduct thorough testing to ensure the dialogs work as expected. Collect
feedback from users and refine the conversation logic based on real-world interactions.

4.5.4 Testing and Debugging Dialogs

Unit 4 Building and Deploying AI Applications 23


Testing and debugging dialogs are essential steps in the development process of a chatbot to ensure
it operates smoothly and provides accurate responses. This involves several phases, including
simulating user interactions, identifying issues, and making necessary adjustments to the dialog flow.
Effective testing and debugging help in refining the chatbot's ability to understand and respond to
various user inputs accurately, improving the overall user experience.

● Manual Testing

Manual testing involves human testers interacting with the chatbot to identify issues. This process
includes:

➔ Simulating User Interactions: Testers simulate real-life user interactions by inputting various
queries and observing the chatbot's responses. This helps in identifying any discrepancies or
unexpected behavior in the dialog flow.
➔ Exploring Various Scenarios: Testers explore different scenarios and edge cases, such as
incorrect inputs, ambiguous queries, and unexpected user behaviors, to see how well the
chatbot handles them.
➔ Iterative Testing: Testers repeatedly test the dialogs after each round of adjustments to
ensure that fixes are effective and do not introduce new issues.
● Automated Testing

Automated testing involves using specialized tools and scripts to test the chatbot's dialogs. This
approach offers several advantages:

➔ Efficiency: Automated tests can run multiple scenarios and edge cases much faster than
manual testing, saving time and resources.
➔ Consistency: Automated tests ensure that the same scenarios are tested every time,
reducing the likelihood of human error and ensuring consistent coverage.
➔ Scalability: Automated tests can handle large volumes of interactions, making them suitable
for chatbots with extensive dialog flows.

Automated testing tools can simulate user interactions, validate responses, and generate reports
highlighting any issues or discrepancies. These tools can be integrated into continuous
integration/continuous deployment (CI/CD) pipelines to ensure that the chatbot is tested continuously
during development.

● Identifying and Fixing Issues

The process of identifying and fixing issues involves several steps:

➔ Logging and Monitoring: Implementing logging and monitoring mechanisms helps track the
chatbot's interactions and identify any issues that arise during user interactions.
➔ Analyzing User Feedback: Gathering and analyzing user feedback provides insights into
common issues and areas for improvement.
➔ Debugging: Developers use debugging tools to trace and fix issues in the dialog flow, such
as incorrect intent recognition, inappropriate responses, and flow disruptions.

Example: H&M’s Chatbot

Unit 4 Building and Deploying AI Applications 24


H&M’s chatbot underwent extensive testing and debugging to ensure it could handle a wide range of
customer inquiries about clothing products, sizes, and availability. The process included:

● Manual Testing: Testers interacted with the chatbot to simulate various customer scenarios,
including questions about product details, size availability, and return policies.
● Automated Testing: Automated tools were used to run scripts that covered a broad
spectrum of queries, ensuring that the chatbot could handle both common and uncommon
user inputs effectively.
● Iterative Refinement: The development team iteratively refined the dialog flow based on
test results and user feedback, making necessary adjustments to improve accuracy and
user satisfaction.

By thoroughly testing and debugging the dialogs, H&M ensured that their chatbot provided a smooth
and satisfying customer experience. This rigorous process helped the chatbot to efficiently assist
customers, answer their queries accurately, and enhance overall customer engagement.

Theory to Practice
● Analyze how does the structure of conversation paths in a chatbot influence user
satisfaction and the effectiveness of the chatbot’s responses? Provide examples of good
and poor conversation path designs.
● Design a basic dialog flow for a vacation planning chatbot. What are the main stages of the
conversation, and what user inputs and bot responses would you include to help users plan
their trips?

Summary

● Artificial Intelligence (AI) encompasses the creation of systems that can perform tasks
typically requiring human intelligence. This unit explores various facets of AI, focusing on
practical applications related to building and deploying AI technologies, particularly
chatbots.
● Chatbots are AI-powered systems designed to interact with users through text or voice,
providing information, assistance, and automating tasks. Understanding these fundamental
aspects helps appreciate the role of chatbots in various domains, from customer service to
personal assistants.
● Creating your own chatbots involves using IBM Watson and IBM Watsonx. This section
introduces the IBM Watson suite of tools, including IBM Watson and IBM Watsonx, and
covers the steps for building a basic chatbot. It highlights how to integrate IBM Watson with
your chatbot and explores its features and capabilities that enhance chatbot functionality
and effectiveness.
● Working with intents involves defining the goals or purposes behind a user's queries. This
section covers the creation and training of intents to ensure that the chatbot understands

Unit 4 Building and Deploying AI Applications 25


and responds to user inputs effectively, with real-world examples demonstrating how intents
are used in various applications to improve user interactions.
● Working with entities includes defining and extracting specific pieces of information from
user inputs. This section addresses the creation and training of entities and provides
examples of how entities are used to understand and process user requests in different
scenarios.
● Creating dialogs involves designing structured conversations between the user and the
chatbot. This section includes designing dialog flows, implementing dialogs, and testing
and debugging to ensure smooth and effective interactions, with real-world examples
showcasing how well-designed dialogs can enhance user experiences and achieve specific
objectives.

Reflection Corner

K W L
What I Know? What I Want to What I Learned
Know?

Concept Overview

Unit 4 Building and Deploying AI Applications 26


Exercise Your Mind

MCQs
Choose the correct answer from the options given below:

1. Chatbots are AI systems designed to simulate human conversation through text or voice
interactions. What is the primary purpose of a chatbot?

A. To perform complex mathematical calculations


B. To interact with users and provide information or assistance
C. To create visual art
D. To manage a database system

2. IBM Watson is a suite of AI tools and services designed to support various AI applications,

Unit 4 Building and Deploying AI Applications 27


including chatbots. Which of the following is a key feature of IBM Watson?

A. 3D Modeling
B. Image Editing
C. Natural Language Processing
D. Video Editing

3. Intents represent the goals or purposes behind user queries in chatbot interactions. What is
the intent in the context of chatbots?

A. A specific user request or goal


B. A type of user data stored in a database
C. A design layout for chatbot interactions
D. A method for encrypting chatbot messages

4. Entities are used to extract specific information from user inputs in chatbot conversations.
What is the role of entities in a chatbot?

A. To create graphical user interfaces


B. To identify and extract specific information from user inputs
C. To manage user authentication
D. To handle database queries

5. Dialogs define the structured conversation flow between the chatbot and the user. What
does a dialog in a chatbot typically include?

A. Visual design elements


B. Predefined conversation paths and responses
C. Encryption algorithms
D. User authentication processes

Short Answer Questions

Answer the following questions briefly:

1. List three key features of a chatbot.


2. Define the term "intent" in the context of chatbot development.
3. Identify two platforms commonly used for building chatbots.
4. Explain the difference between an intent and an entity in chatbot design.
5. Describe the role of dialog flows in chatbot functionality.

Higher Order Thinking Skills (HOTS) Questions

Answer the following questions in detail:

1. Chatbots are becoming increasingly sophisticated, blurring the lines between human and
machine interaction. Discuss the potential ethical implications of using chatbots in

Unit 4 Building and Deploying AI Applications 28


customer service applications. How can we ensure transparency and build trust with users
interacting with AI-powered chatbots?
2. Imagine a chatbot designed to assist patients in a hospital setting. What specific
functionalities would be beneficial for such a chatbot? Consider features like appointment
scheduling, medication reminders, and basic symptom analysis. How can these
functionalities be implemented while prioritizing patient privacy and security concerns?
3. Analyze the potential future advancements in chatbot technology. How might chatbots
become even more integrated into our daily lives, and what new applications might
emerge? Discuss the challenges and opportunities associated with the widespread
adoption of advanced chatbots.
4. Think beyond traditional customer service applications. Propose a creative way a chatbot
could be used to solve a problem or address a specific need in a particular industry (e.g.,
education, healthcare, environmental conservation). Describe the functionalities and
design of your chatbot solution.
5. Research two popular chatbot development platforms (e.g., IBM Watson, Microsoft Bot
Framework). Compare and contrast their features, ease of use, and suitability for different
types of chatbot applications. Which platform would you recommend for a specific
scenario, and why?

Answers
MCQs
1. Answer: B. To interact with users and provide information or assistance
Explanation: The main purpose of a chatbot is to interact with users through text or voice,
providing information, assistance, or automating tasks. This interaction is designed to simulate
human conversation and address user needs.
2. Answer: C. Natural Language Processing
Explanation: IBM Watson is known for its Natural Language Processing (NLP) capabilities, which
allow it to understand and generate human language, a crucial feature for developing chatbots.
3. Answer: A. A specific user request or goal
Explanation: An intent represents the user’s purpose or goal behind a query. It helps the chatbot
understand what the user is trying to achieve, allowing it to provide appropriate responses.
4. Answer: B. To identify and extract specific information from user inputs
Explanation: Entities are used to capture details from user inputs, such as names, dates, or
locations. They help the chatbot understand the specifics of the user’s request and provide
accurate responses.
5. Answer: B. Predefined conversation paths and responses
Explanation: A dialog includes predefined conversation paths and responses. It guides how the
chatbot interacts with users, determining how it responds to various inputs and manages the flow of
the conversation.

Unit 4 Building and Deploying AI Applications 29


Reference
● Noble, S. U. (2018). Algorithms of oppression: How search engines reinforce racism. NYU
Press.
● Benjamin, R. (2019). Race after technology: Abolitionist tools for the new Jim code. Polity
Press.
● Broussard, M. (2018). Artificial unintelligence: How computers misunderstand the world.
MIT Press.
● Dr. Alfio Gliozzo, Ackerson, C., Bhattacharya, R., Goering, A., Jumba, A., Seung Yeon Kim,
Krishnamurthy, L., Lam, T., Littera, A., McIntosh, I., Murthy, S., Ribas, M., & IBM Redbooks.
(2017). Building Cognitive Applications with IBM Watson Services: Volume 1 Getting
Started. IBM Redbooks.
● Martijn Verhoeven. (2018). Getting started with artificial intelligence : managing your first AI
bot. Prefer Limited.
● Russell, S. J., & Norvig, P. (2016). Artificial intelligence: A modern approach (4th ed.).
Boston, MA: Pearson.
● Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning. MIT Press.
● Chollet, F. (2019). Grokking Deep Learning. Manning Publications.

Unit 4 Building and Deploying AI Applications 30

You might also like