In this chapter we will create an Amazon Lex Chatbot to query the Kendra index. The objective of this exercise is to demonstrate how a Lex Chatbot and Kendra based search can be combined to create a solution having a conversational question and answer interface. For more information please refer to https://docs.aws.amazon.com/lex/latest/dg/ex-agent.html
Open the Amazon Lex management console
In the navigation pane, choose Bots
Choose Create
Choose Custom bot
Choose Create. This will look as below.
On the Getting started with your bot page, choose Create Intent
In the Add intent pop-up, choose Create intent
In the Create intent dialog box, enter a descriptive name for the intent such as RequiredIntent.
For Sample uterances, enter a descriptive utterance, such as Required utterance. This will look as below.
Choose save intent.
In the navigation pane, choose the plus sign (+) next to Intents.
Choose Search existing intents.
In the Search intents box, enter AMAZON.KendraSearchIntent, then choose it from the list.
Give the intent a descriptive name, such as DemoSearchIntent, then choose Add.
In the intent editor, choose Amazon Kendra query to open the query options.
Choose the index that you have created earlier in the workshop
In the Response section, add the following three messages to a message group.
I found an answer for the customer query: ((x-amz-lex:kendra-search-response-question_answer-question-1)) and the answer is ((x-amz-lex:kendra-search-response-question_answer-answer-1)).
I found an excerpt from a helpful document: ((x-amz-lex:kendra-search-response-document-1)).
I think this answer will help the customer: ((x-amz-lex:kendra-search-response-answer-1)).
This will look as below:
Choose Save intent
Choose Build to build the bot
After the build is complete open the Test bot pane on the right side of the screen
Type a query. You can use “What is operational excellence?” as an example. You should see something like the image below. Try a few more queries
Congratulations! You have successfully integrated a Lex Chatbot with a Kendra index.