Integrating Amazon Kendra
Amazon Kendra
-
Use Amazon Kendra’s FAQ queries to match users' questions to the answers in the solution’s knowledge base. Amazon Kendra’s machine learning models can handle many variations in how users phrase their questions, and this can reduce the amount of tuning needed for the solution to find the right answer from your knowledge base.
-
Use Amazon Kendra’s document index as a fallback source of answers when a question/answer is not found in the solution’s knowledge base.
For more information, see Amazon Kendra Pricing
Using Amazon Kendra FAQ for question matching
Use the following procedure to configure the solution to use your Amazon Kendra index to answer questions from the data populated in the content designer:
-
Set the KendraFaqIndexId CloudFormation parameter to the ID of the Amazon Kendra index to use. Find the index ID in the Amazon Kendra console.
-
Replicate all items from the content designer to the Amazon Kendra index:
-
Select the menu (⋮) from the top right in the content designer.
-
Choose SYNC KENDRA FAQ and wait for it to complete - it might take a few minutes.
-
The solution will now use Amazon Kendra FAQ queries to find matches to end users' questions. Use the ALT_SEARCH_KENDRA_FAQ_CONFIDENCE_SCORE setting to adjust the confidence threshold for Amazon Kendra FAQ answers used by QnABot on AWS.
If Amazon Kendra FAQ cannot find an answer that meets the confidence threshold, the solution will revert by default to using an Amazon OpenSearch Service query. The combination of Amazon Kendra FAQ and Amazon OpenSearch Service gives you the best of both worlds.
Note
When adding your Amazon KendraFaqIndexId in CloudFormation, also add the index ID in AltSearchAmazon KendraIndexes.
Using Amazon Kendra search as a fallback source of answers
You can add one or more data sources to your Amazon Kendra index, and configure the solution to query your index any time it gets a question that it doesn’t know how to answer.
-
Set the AltSearchAmazon KendraIndexes CloudFormation parameter to specify one or more Amazon Kendra indexes to use for fallback searches.
The value of AltSearchAmazon KendraIndexes parameter should be specified as a string containing index IDs separated by comma, for example:
857710ab-example-do-not-copy
-
Or -
857710ab-example1-do-not-copy,857710ab-example2-do-not-copy
QnABot on AWS also supports Amazon Kendra index authentication token pass through.
-
Set the AltSearchAmazon KendraIndexes CloudFormation parameter to specify one or more Amazon Kendra indexes to use for fallback searches. You must control user access to documents with tokens using OpenID. For more information, see the Amazon Kendra Fallback Function
section in the GitHub repository. -
Set the AltSearchAmazon KendraIndexAuth CloudFormation parameter to
TRUE
. This enables QnABot to send an OpenID Token to Amazon Kendra index(es) to limit Amazon Kendra results to which the user is entitled. -
Input the IDENTITY_PROVIDER_JWKS_URLS QnABot content designer settings parameter. Find your token key signing URL from the Cognito user pool of QnABot or
Lex-Web-Ui
.Note
When configuring your Amazon Kendra index with user access control, Amazon Kendra only allows you to specify one signing key URL from one Cognito user pool. Having multiple Cognito pools, including
Lex-Web-Ui
, requires you to set up multiple Amazon Kendra indexes.
Amazon Kendra redirect
QnABot on AWS supports multiple mechanisms for dynamic interaction flows. For example:
-
Using Lambda hooks in a given Item ID to perform additional actions, such as creating a ticket, resetting a password, and saving data to a data store.
-
Using an Amazon Kendra index as a fallback mechanism to look for answers to user’s questions.
There are various options to process Amazon Kendra queries. One option is to create a custom Lambda hook and map it to an Item ID. The Lambda hook then includes the business logic to use an Amazon Kendra index and process the query.
The Amazon Kendra redirect feature provides a much simpler option. You can include an Amazon Kendra query within an Item ID, and QnABot will do the rest to process the Amazon Kendra request and respond back with the results.
Configuring an Item ID with Amazon Kendra redirect
You can configure an Item ID with Amazon Kendra Redirect UI.
Amazon Kendra redirect configuration

-
Create a QnABot question as you would normally do by providing an Item ID and questions and utterances.
-
Expand the Advanced option.
-
Amazon Kendra Redirect: Query Text accepts a QueryText to search for (for example
what is q and a bot
) and retrieve the answer from the Amazon Kendra fallback index specified in the CloudFormation stack parameters. Amazon Kendra searches your index for text content, question, and answer (FAQ) content. You can also use Handlebars to substitute values using session attributes or slots to support dynamic queries. -
Amazon Kendra Redirect: Confidence score threshold provides a relative ranking that indicates how confident Amazon Kendra is that the response matches the query. This is an optional field having one of the values of:
LOW
,MEDIUM
,HIGH
,VERY HIGH
. If no value is provided, the value for the ALT_KENDRA_FALLBACK_CONFIDENCE_THRESHOLD setting is used. -
Amazon Kendra query arguments is an optional field that allows filtered searches based on document attributes, for example,
"AttributeFilter": {"EqualsTo": {"Key": "City", "Value": {"StringValue": "Seattle"}}}
. You can also use Handlebars to substitute values using session attributes or slots to support dynamic queries.
For more information on using Amazon Kendra query arguments, see the Amazon Kendra Query API in the Amazon Kendra__API Reference.
Note
-
Answer fields are ignored when
Amazon KendraRedirect
query is used. -
Use this feature for use cases where you have Item IDs that directly need to interact with an Amazon Kendra index as configured in the CloudFormation stack parameters.
-
When applying Amazon Kendra query arguments, check if the document fields are searchable. Searchable determines whether the field is used in the search. For more information, see Mapping data source fields in the _Amazon Kendra_Developer Guide.
Web page indexer
This solution can answer questions based on the content of web pages.
-
In the CloudFormation stack, set the Amazon KendraWebPageIndexId parameter to
Existing Amazon Kendra Index ID
. Add the same index ID for the AltSearchAmazon KendraIndexes parameter. -
From the content designer, select the tools menu (☰), and then choose Settings.
-
Modify the following settings:
-
ENABLE_WEB_INDEXER: true
-
*KENDRA_INDEXER_URLS: * link:https://aws.amazon.com/lex/faqs/
-
KENDRA_INDEXER_SCHEDULER: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#RateExpressions
-
-
From the content designer, select the tools menu ( ☰ ), and then choose Amazon Kendra Web Crawler.
-
Choose START INDEXING.
-
Wait for indexing to complete. It can take several minutes.
-
-
Open the web UI, and ask
"What is Lex?"
. QnABot on AWS provides an answer with a link to the Amazon Lex FAQ page.
For more information on web page indexing, see the README.md