Amazon Lex Chatbot for Kendra

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

  1. Open the Amazon Lex management console
  2. In the navigation pane, choose Bots
  3. Choose Create
  4. Choose Custom bot
  5. Choose Create. This will look as below.
    Bot image 1
  6. On the Getting started with your bot page, choose Create Intent
  7. In the Add intent pop-up, choose Create intent
  8. In the Create intent dialog box, enter a descriptive name for the intent such as RequiredIntent.
  9. For Sample uterances, enter a descriptive utterance, such as Required utterance. This will look as below.
    Bot image 2
  10. Choose save intent.
  11. In the navigation pane, choose the plus sign (+) next to Intents.
  12. Choose Search existing intents.
  13. In the Search intents box, enter AMAZON.KendraSearchIntent, then choose it from the list.
  14. Give the intent a descriptive name, such as DemoSearchIntent, then choose Add.
  15. In the intent editor, choose Amazon Kendra query to open the query options.
  16. Choose the index that you have created earlier in the workshop
  17. 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:

Bot image 3

  1. Choose Save intent
  2. Choose Build to build the bot
  3. After the build is complete open the Test bot pane on the right side of the screen
  4. 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
Bot image 4

Congratulations! You have successfully integrated a Lex Chatbot with a Kendra index.