DEV Community

Cover image for Book a vacation with Amazon Lex Automated Chatbot Designer (Preview) - Conversational AI - Part 1
Wendy Wong for AWS Community Builders

Posted on • Updated on

Book a vacation with Amazon Lex Automated Chatbot Designer (Preview) - Conversational AI - Part 1

The rise of Conversational AI

Industries ranging from travel, startups, telecommmunications want
to provide a unique customer experience, reach customers globally and provide customer support to engage with customers with a digital experience via voice calls or text.

In this 24/7 economy, some customer profiles e.g. professionals,
and millenials might prefer to contact a company after hours and choose not to speak directly to a contact centre agent or type with a live agent.

For example a professional might prefer to research and switch health insurance online, book a holiday or shop online at 11pm at night - in those given scenarios you just might meet a chatbot when you click on the landing page of a company website and click-through tabs.

Below is an example of a chatbot session with telecommunications provider Optus a subsidiary of Singapore Telecommunications Limited for researching cell phones.

optus chatbot

In this global economy, contact centres may operate locally or within a shared services model with agents that you can speak with during business hours from 9am to 5pm and then outsource until 8pm to neighbouring Asian countries such as Singapore, Mumbai, Malaysia and thereafter switch on a chat bot to act as a concierge service to answer FAQs.

What is Conversational AI?

According to Deloitte, conversational AI is:

A programmatic and intelligent way of offering a conversational experience to mimic conversations with real people, through digital and telecommunication technologies

Conversational AI brings together 8 technology components including the following:

  • Natural Language Processing (NLP): The ability to read or parse human language text
  • Intent Recognition: The ability to understand what the user is requesting
  • Entity Recognition: Some text
  • Fulfilment: Pull data from web services using APIs or databases
  • Voice Optimised Responses: Engage in conversations in a human-like manner and show emotions to optimise the experience
  • Dynamic Text to Speech: Converts written text to natural language
  • Machine Learning: Understand the customer by analyzing agent responses
  • Contextual Awareness: Ability to follow conversation history, translate, recall, memorise information over conversations

What is Amazon Lex V2?

Amazon Lex is an AWS Service that builds conversational interfaces with voice and text. This enables developers to build chatbots within minutes instead of weeks using the Amazon Lex console.

Benefits of building a bot with Amazon Lex V2

  • You can analyze thousands of lines of audio transcripts and reduce effort to find the intent (i.e. the action the user wants to perform) using machine learning.

  • You may build, test and deploy chatbots for websites, contact centres and messaging channels in a matter of hours instead of weeks.

  • You can build a minimum viable product and then iterate to improve conversation design

  • You can use chatbots to improve customer experience by designing intents that have well defined intent names, sample utterances and create a Lambda function to fulfill the intent.

[NEW] from Amazon re:invent 2021 - Amazon Lex Chatbot Designer (Preview)

At AWS re:Invent 2021 there was an announcement of Amazon Lex Chatbot Designer in preview which means that you can test drive and build a chatbot using this service free of charge for a limited period.

You may re-play and watch the announcement from AWS re:Invent 2021 at this link below with Jenna Pederson, Sr. Developer Advocate, Gunnar Grosch, Sr. Developer Advocate and Harshal Pimpalkhute, Product Manager

AWS re:Invent 2021 - AWS On Air ft. Automated chatbot designer in Amazon Lex

High level architecture

This reference architecture from AWS provides an overview of how the Amazon Chatbot Designer works.The automated chatbot designer (preview) allows you to use your existing conversation transcripts. It analyzes the transcripts and suggests an initial design with intents and slot types.

Step 1: Input your audio transcripts into Amazon S3

Step 2: Transcripts are loaded into Amazon Chatbot Designer

Step 3: Deep Learning techniques will group and extract the intents (i.e. the reason for the phone call)

Step 4: The bot design will produce a list of intents that can be reviewed for intents and slot types

Chatbot Architect

How to create a bot with Amazon Lex V2

There are four steps to create a bot with Amazon Lex V2

Step 1: Create a bot and add one or more languages

Configure the bot to do the following:

a) Understand the user goal
b) Engages conversation with the user to obtain information and
c) Fulfills the user's intent

Step 2: Test the bot

Use the test window client provided by Amazon Lex V2 console to test the bot.

Step 3: Publish the a version of the bot and create an alias.

Step 4: Deploy the bot. You can deploy the bot on your messaging channels such as Facebook Messenger and Slack.

Tutorial 1: Build a Chatbot with Amazon Lex Automatic Chatbot Designer (Preview) with existing data

Below is a chatbot session with online flight booking provider Last Minute for researching flight information outside business hours.

bookfligthn

Step 1: Click on URL for Chatbot Designer

pic 1

Step 2: Create an example bot to Book a flight

Step 3: Sign into the Amazon Lex V2 console with your login details for IAM user for your Amazon account

If you do not have administrator user access you may follow the steps in the blog or read the instructions from the user guide here

iam console

Step 4: In the Amazon Lex V2 bot console click Create bot.

V2

Step 5: For the Creation method, choose Start with an example

start with an example

Step 6: In the Example bots section, select from the drop-down menu BookTrip

booktrip

Step 7: In the Bot configuration give the bot a name and a description for the purpose of creating a bot

bot configuration

Step 8: In the Permissions section, choose Create a role with basic Lex permissions

IAM

IAM permissions are required to run the bot.

Step 9: In the Children's Online Privacy Protection Act(COPPA) section read the terms and conditions and make the right choice.

coppa

Step 10: In the Session timeout and Advanced settings retain the default settings and click Next. Amazon Lex 2 will create the bot.

session

Add language to a Bot

Step 1: In the Language section, choose a language and provide a description. Select from the drop-down menu English(GB) and in the description type British accent

Step 2: Leave Voice interaction and Intent classification confidence score threshold with default settings.

Step 3: Select Add language to add a language to the bot.

Select Emma from the drop-down menu and use Standard speech-to-text.

Step 4: After the language is added, choose Done to continue.

Emma

Use the intent editor to inspect the intents used by the bot and once you are satisfied you can test the bot.

To test the BookFlight bot

Step 1: From the bottom of the menu, click Build. Wait a few seconds for the bot to be created.

bot build

Step 2: After the bot has been created, click Test to open the test window.

Step 3:Test the bot.Start the conversation with a sample utterance or type your own e.g. "I would like to book a flight to London"

Test bot

AWS re:Invent 2021 - Amazon Lex

Demo of Amazon Lex Automated Chatbot Designer. re:Invent 2021 recaps

Getting Started with Amazon Lex

Best practices for Conversation Design with Amaxzon Lex

References

What is Conversational AI?

Building bots

Amazon Lex Chatbot Designer (Preview)

Create an IAM User role

Glossary

Amazon Lex core concepts explained here

Bot – A bot performs automated tasks such as ordering a pizza, booking a hotel, ordering flowers, and so on. An Amazon Lex V2 bot is powered by automatic speech recognition (ASR) and natural language understanding (NLU) capabilities.

Amazon Lex V2 bots can understand user input provided with text or speech and converse natural language.

Language – An Amazon Lex V2 bot can converse in one or more languages. Each language is independent of the others, you can configure Amazon Lex V2 to converse with a user using native words and phrases. For more information, see Languages and locales supported by Amazon Lex V2.

Intent – An intent represents an action that the user wants to perform. You create a bot to support one or more related intents. For example, you might create an intent that orders pizzas and drinks. For each intent, you provide the following required information:

Intent name – A descriptive name for the intent. For example, OrderPizza.

Sample utterances – How a user might convey the intent. For example, a user might say "Can I order a pizza" or "I want to order a pizza."

How to fulfill the intent – How you want to fulfill the intent after the user provides the necessary information. We recommend that you create a Lambda function to fulfill the intent.

Slot – An intent can require zero or more slots, or parameters. You add slots as part of the intent configuration. At runtime, Amazon Lex V2 prompts the user for specific slot values. The user must provide values for all required slots before Amazon Lex V2 can fulfill the intent.

For example the OrderPizza intent requires slots such as size, crust type, and number of pizzas. For each slot, you provide the slot type and one or more prompts that Amazon Lex V2 sends to the client to elicit values from the user. A user can reply with a slot value that contains additional words, such as "large pizza please" or "let's stick with small." Amazon Lex V2 still understands the slot value.

Slot type – Each slot has a type. You can create your own slot type, or you can use built-in slot types.

Version – A version is a numbered snapshot of your work that you can publish for use in different parts of your workflow, such as development, beta deployment, and production.

Alias – An alias is a pointer to a specific version of a bot.

Happy Learning! 😁

Next Tutorial: Building a custom bot with automated chatbot designer in Amazon Lex (Preview) - Conversational AI- Part 2

Top comments (8)

Collapse
 
zachjonesnoel profile image
Jones Zachariah Noel

Wow! I've tried Lex v1 and v2 looks much more elegant and this is a good read of how to setup of a Lex bot. 👍👍

Collapse
 
abc_wendsss profile image
Wendy Wong

Thanks for your kind words! Yes it's very easy to build with Lex V2, glad to know you can see the difference compared to V1 :)

Collapse
 
zachjonesnoel profile image
Jones Zachariah Noel

Absolutely love how it has evolved. 😝 Gonna try it sometime and also thanks for the multi-part blog. 👍👍

Just a structural organization suggestion - you can create it as a series so navigating between different parts is easier.

Thread Thread
 
abc_wendsss profile image
Wendy Wong

Thanks Jones for providing great feedback, I just remembered Adit's article and have just implemented the Series, it was so easy to do. Thanks for wearing your Editor's hat :)

Collapse
 
anuvindhs profile image
Anuvindh

This is def on my do list , awesome work Wendy

Collapse
 
abc_wendsss profile image
Wendy Wong

Thanks Anuvindh, please test drive it using Lex V2 :)

Collapse
 
fajar7xx profile image
Fajar Siagian

hello.
i have an error when access it using laravel they said my aliasname error, but i have create it one.

Collapse
 
abc_wendsss profile image
Wendy Wong

Hi Fajar,

Amazon Lex V2 is still in preview, do take the time to read the documentation as the features may not be available in Indonesia. Please kindly refer to the link about region availability: docs.aws.amazon.com/general/latest....

Regards, Wendy