Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
Bob Potterveld committed Jul 3, 2021
2 parents 4112674 + b373509 commit 1ca6575
Show file tree
Hide file tree
Showing 113 changed files with 6,048 additions and 9,340 deletions.
5 changes: 5 additions & 0 deletions .vscode/spellright.dict
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ gotanswer
qnabotcontext
nnn-nn-nnnn
Conne
ssml
cardtitle
cardimageurl
buttonvalue
py_lambda_hooks
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
- QnABot's Elasticsearch cache is now automatically kept warm to improve query time consistency.
- Negative feedback (thumbs down) messages can now generate notifications (text, email, etc.) using Amazon SNS.

## [4.7.1]
- Amazon Elasticsearch version 7.10 is now utilized.
- Encrypted Elasticsearch (production) instance types now use m6g.large.elasticsearch for improved price/performance/memory.
- The QnABot fulfillment Lambda function has been optimized to reduce query response times and variability,
especially after periods of inactivity.
- LexV2 built-in Elicit Response bots have been added.
- Custom settings can now be exported and imported from the Content Designer Settings page.
- Bug fix when ES_SCORE_ANSWER_FIELD is set to true. Prior to this fix, answer fields were not
utilized fully in Elasticsearch queries.
## [4.5.2]
- Fix for new Kendra resources deployed in VPC addressing issues in 4.5.0 and 4.5.1.
## [4.5.1]
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ This repository contains code for the QnABot, described in the AWS AI blog post

See the "Getting Started" to launch your own QnABot.

**See all the new features list for 4.7.1** [Lex V2 Elicit response bots, Config import/export](#new-features)

4.7.1 provides performance improvements and component upgrades
- Amazon Elasticsearch version 7.10 is now utilized.
- Encrypted Elasticsearch (production) instance types now use m6g.large.elasticsearch for improved price/performance/memory.
- The QnABot fulfillment Lambda function has been optimized to reduce query response times and variability,
especially after periods of inactivity.
- LexV2 built-in Elicit Response bots have been added.
- Custom settings can now be exported and imported from the Content Designer Settings page.
- Bug fix when ES_SCORE_ANSWER_FIELD is set to true. Prior to this fix, answer fields were not
utilized fully in Elasticsearch queries.

4.7.0 QnABot now supports LexV2 with voice interaction in multiple languages.
- Two installation/update modes are now available:
- (i) LexV1 + LexV2 (default, recommended for most AWS regions.
- (ii) LexV2-only (currently recommended for AWS regions where LexV1 is not available).

**See all the new features in 4.7.0** [LexV2 support, Excel Import, New Canada Central region](#new-features)


4.6.0 provides a number of new features described below. Several to call attention to are the following:

- Kendra custom no_hits item required in earlier releases is no longer required to enable Kendra Fallback and should be removed, configurable confidence thresholds now available for filtering Kendra results.
Expand Down Expand Up @@ -118,6 +128,10 @@ See the [LICENSE.md](LICENSE.md) file for details

## New features

### Version 4.7.1
- LexV2 built-in Elicit Response bots have been added.
- Custom settings can now be exported and imported from the Content Designer Settings page.

### Version 4.7.0

- QnABot now supports LexV2 with voice interaction in multiple languages.
Expand Down
1 change: 1 addition & 0 deletions bin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports={
"devEncryption": "UNENCRYPTED",
"devPublicOrPrivate": "PUBLIC",
"namespace":"dev",
"LexBotVersion":"LexV1 and LexV2",
"stackNamePrefix":"QNA"
}

Expand Down
8 changes: 4 additions & 4 deletions bin/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function up(stack,options){
if(Buffer.byteLength(template)<51200){
var create=await cf.createStack({
StackName,
Capabilities:["CAPABILITY_NAMED_IAM"],
Capabilities:["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],
DisableRollback:true,
TemplateBody:template
}).promise()
Expand All @@ -131,7 +131,7 @@ async function up(stack,options){
}).promise()
var create=await cf.createStack({
StackName,
Capabilities:["CAPABILITY_NAMED_IAM"],
Capabilities:["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],
DisableRollback:true,
TemplateURL:url
}).promise()
Expand Down Expand Up @@ -164,7 +164,7 @@ function update(stack,options){
if(Buffer.byteLength(template)<51200){
var start=cf.updateStack({
StackName,
Capabilities:["CAPABILITY_NAMED_IAM"],
Capabilities:["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],
TemplateBody:template
}).promise()
}else{
Expand All @@ -180,7 +180,7 @@ function update(stack,options){
}).promise()
.then(()=>cf.updateStack({
StackName,
Capabilities:["CAPABILITY_NAMED_IAM"],
Capabilities:["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],
TemplateURL:url
}).promise())
})
Expand Down
Binary file added docs/recent_topics_lambda_hook_example/Import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions docs/recent_topics_lambda_hook_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Create Recent Topics Response Walkthrough

The CreateRecentTopicsResponse Lambda hook demonstrates how you can extend QnABot with custom functionality.

The Lambda hook allows you to add buttons to a question with the recent topics answered by QnABot.

## Importing the sample question bank

Choose *Import* from the Tools menu.

![Import Tool](./Import.png)

Load the *RecentTopicsDemo* question bank.

![Import question bank](./Import_qnabank.png)

The sample question bank is loaded with questions tagged with topics.

![Question List](./question_list.png)

QnABot stores the topics of questions answered in a DynamoDB table per user.

## Importing custom settings

QnABot needs three pieces of information to display the buttons - the topic, the text that should be displayed on the button and the question
that should be asked based on the button selected.

The configuration for the buttons is done by adding custom settings in the Setting window.

- Download the [recent topics settings](./recent_topics_settings.json) json file from the QnABot repository.
- Go to the Settings screen, choose "Import Settings" and import the recent_topics_settings.json file.
![Import Dialog](./import_dialog.png)
- You should now see the custom settings loaded.
![Loaded Settings](./loaded_settings.png)

Notice the format of a setting that maps a topic to a button is:

- topic::\<topic\> -- the name of the topic for QnABot to remember.
- \<display text\>::\<QID\> -- the display text of the button and the ID of the question to be asked when the button is selected separated by two colons (::)

## Configuring the Lambda hook

You can have a combination of static buttons and dynamic buttons generated by the CreateRecentTopicsResponse Lambda hook.

Edit the *PreviousTopics* question and expand the *Advanced* section.

![Response card settings](./response_card.png)

- The *Card Title* is required. But is not displayed.
- Under *Lex Buttons* a button with the text "Ask Another Question" will always be displayed. If chosen, the answer for the question with an ID of General.001 will be returned to the user.
- The Lambda hook (QNA:EXTCreateRecentTopicsResponse) will be called with the parameters specified under *Lambda Hook Arguments*. This tells the Lambda hook to return the most recent topic (*"start":"0"*) and return at most five (*"end":5*) buttons.

## Adding a topic to be recalled

Let's add another question.

- In Content Designer, click "Add" to add a question.
- Item ID - Textract.001
- Question - "What is Amazon Textract
- Answer `Amazon Textract is a machine learning service that automatically extracts text, handwriting and data from scanned documents that goes beyond simple optical character recognition (OCR) to identify, understand, and extract data from forms and tables.`

![Textract](./textract.png)

- Expand the "Advanced" Section
- Markdown Answer `Amazon Textract is a machine learning service that automatically extracts text, handwriting and data from scanned documents that goes beyond simple optical character recognition (OCR) to identify, understand, and extract data from forms and tables.`
- Topic - "Textract"
- click on "Create"

![Advanced configuration](./advanced.png)

- Now edit the AI.001 question and expand the "Advanced" section to add another button.
- Click "ADD LEX BUTTON"
- Display Text - Amazon Textract
- Button Value - QID::Textract.001
- Click "Update"

![Add Lex Button](./add_lex_button.png)

- Finally, you will need to add a custom setting.
- Click "ADD NEW SETTING"
- Click "Save"

![Add New Setting](./add_new_setting.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"topic::Comprehend":"Amazon Comprehend::Comprehend","topic::Kendra":"Amazon Kendra::Kendra","topic::Lex":"Amazon Lex::Lex","topic::Polly":"Amazon Polly::Polly","topic::SageMaker":"Amazon SageMaker::SageMaker","topic::Translate":"Amazon Translate::Translate"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"topic::Comprehend": "Amazon Comprehend::Comprehend",
"topic::Kendra": "Amazon Kendra::Kendra",
"topic::Lex": "Amazon Lex::Lex",
"topic::Polly": "Amazon Polly::Polly",
"topic::SageMaker": "Amazon SageMaker::SageMaker",
"topic::Translate": "Amazon Translate::Translate"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions lambda/aws-sdk-layer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
NAME=$(shell basename $(shell pwd))
DST=../../build/lambda/$(NAME).zip

RESOURCES := $(shell find . | grep -v node_modules | grep -v test )

$(DST): $(RESOURCES)
echo "Building $(NAME)";
npm install -production
rm -r ./nodejs || true
mkdir ./nodejs
mv node_modules ./nodejs/node_modules
zip -r $(DST) .
Loading

0 comments on commit 1ca6575

Please sign in to comment.