-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # CHANGELOG.md
- Loading branch information
Showing
113 changed files
with
6,048 additions
and
9,340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,8 @@ gotanswer | |
qnabotcontext | ||
nnn-nn-nnnn | ||
Conne | ||
ssml | ||
cardtitle | ||
cardimageurl | ||
buttonvalue | ||
py_lambda_hooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
 | ||
|
||
Load the *RecentTopicsDemo* question bank. | ||
|
||
 | ||
|
||
The sample question bank is loaded with questions tagged with topics. | ||
|
||
 | ||
|
||
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. | ||
 | ||
- You should now see the custom settings loaded. | ||
 | ||
|
||
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. | ||
|
||
 | ||
|
||
- 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.` | ||
|
||
 | ||
|
||
- 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" | ||
|
||
 | ||
|
||
- 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" | ||
|
||
 | ||
|
||
- Finally, you will need to add a custom setting. | ||
- Click "ADD NEW SETTING" | ||
- Click "Save" | ||
|
||
 |
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.
1 change: 1 addition & 0 deletions
1
docs/recent_topics_lambda_hook_example/recent topic settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"} |
8 changes: 8 additions & 0 deletions
8
docs/recent_topics_lambda_hook_example/recent_topics_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) . |
Oops, something went wrong.