Voiced by Amazon Polly
Amazon Lex V2 is an AWS service that is used to build conversational interfaces using both text and voice. Amazon Lex V2 can help any developer to build bots quickly. To create a bot, you just need to give a basic conversational flow. Using the Amazon Lex V2 console you can build, test, and then deploy the bot to your applications.
To know more about Bot Creation using Amazon Lex V2 here.
Demo to Create a Voice Bot
Now I will walk you through the steps to create a voice bot to order a pizza.
Step1 – Open AWS Console and navigate to the Amazon Lex V2.
Step2 – Creating a bot:
- Choose Create bot.
- For the Creation method, choose Create a blank bot.
- In the Bot configuration give the bot’s name as pizza_bot and a description.
- In the Permissions section, choose Create a new role with basic Amazon Lex permissions. This will create an AWS IAM role.
- In the Children’s Online Privacy Protection Act, choose option no.
6. In the Session timeout and Advanced settings sections, leave the defaults.
7. Choose Next. Amazon Lex V2 creates your bot.
Note: After creating a bot, we should add one or more languages that are supported by the bot.
Step3 – Adding a language:
- In the Language section, choose English-IN for Indian English, and add a description.
- In the Voice interaction choose Aditi and Leave Intent classification confidence score threshold with their default.
- Choose Add language to add the language to the bot.
- After the language is added, choose Done to continue.
Note: After you choose Done, the console opens the intent editor. We use the intent editor to create the intents and add slots that are used by the bot. Fallback intent is the default intent that is created during bot creation time, and it sends a response when the bot didn’t understand the user utterance.
Step4 – Create an Intent:
- In the Intent Details section, give the name of the intent as pizza and add the description.
- In the sample utterances section mention all the utterances you expect the user to make.
3. In the initial Response section, Mention the message that to send to the user after the intent is recognized but before Amazon Lex begins gathering slot values.
4. Now we need to add the slots to take the user information.
5. In the slot type page, go to Add slot type slot and choose add blank slot type, now give the name of your slot as pizza-type and press add.
- Now the pizza-type slot will open and then in slot value resolution choose, restrict to slot values.
- Value – Type veg, In the new value field type veg pizza. Choose add value. Type nonveg and in the new value field type nonveg pizza, then choose add value again. Now choose save slot type to save the values.
6. Now navigate back to an intent page and choose add slot and give the name of the slot as pizza-type and select the custom slot from the dropdown and in the prompt type what kind of pizza would you like to order? And press add.
7. Now repeat steps 5 and 6 for the below values:
- Slot name: size
- Values: small, medium, large.
- Prompt: what is the size of pizza you want?
- Slot name: crust
- Values: thin, thick.
- Prompt: what is the crust type?
8. Now, enable the confirmation section, give “can I go ahead with your request?” in the confirmation prompt and “okay, your request is canceled.” In decline response.
9. Now enable the fulfillment and “your request is completed successfully” in successful fulfillment and “something went wrong” in case of failure.
10. Now enable the closing response and give “Thank you for choosing me” in the message tab.
11. Now save intent and build and test your bot.
Amazon Lex V2 is an easy-to-use service using which we can’t create a bot with just a few clicks. This won’t have any upfront cost it follows the pay-as-you-go model. This supports multiple languages; we can build the same bot in multiple languages. This also has an import and export feature using which one can import the bot created in another AWS account or export the bot to another AWS account.
CloudThat is also the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
Drop a query if you have any questions regarding Amazon Lex V2 and I will get back to you quickly.
1. Can I delete the Amazon Lex voice and text messages?
ANS: – Yes, by contacting opting out we can delete the voice and text inputs of amazon lex.
2. Do I still own my content that is processed and stored by Amazon Lex?
ANS: – You always own your content only with your consent, content can be used.
3. How to create Amazon Lex bots for mobile?
ANS: – Amazon Lex has SDKs for both Android and iOS. We can create bots for mobile using these SDKs. Using Amazon Cognito, we can authenticate bots.
WRITTEN BY Lakshmi P Vardhini