Skip to content

Commit

Permalink
update documentation for 4.7.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Potterveld committed Jun 6, 2021
1 parent 941ac35 commit e5ad7da
Show file tree
Hide file tree
Showing 59 changed files with 341 additions and 3,172 deletions.
6 changes: 2 additions & 4 deletions .vscode/spellright.dict
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ arn
qid
Nutritionix
'qna'
Logstash
quniqueterms
Node.js
ap
ctz
Expand All @@ -33,7 +35,3 @@ gotanswer
qnabotcontext
nnn-nn-nnnn
Conne
ssml
cardtitle
cardimageurl
buttonvalue
460 changes: 29 additions & 431 deletions README.md

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions VPCSupportREADME.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# VPC Support - Preview Mode
(version 1.0 - December 2020)

QnABot now provides in Preview Mode deployment using a VPC.
This feature allows deployment of QnABot components within VPC infrastructure via a new template named public-vpc-support.json.
This template is made available for use as a separate installation mechanism. It is not the default template utilized in the
public distribution buckets. Please take care in deploying QnABot in VPC. The Elasticsearch Cluster
becomes bound to the VPC as well as the Lambda's installed. The Elasticsearch cluster is no longer available
outside of the VPC. All Lambdas are bound to the VPC to allow communication with the cluster.

Two additional parameters are required by this template.

- VPCSubnetIdList (two private subnets spread over two availability zones - see below)
- VPCSecurityGroupIdList (see below)

### Requirements

In order for deployment of resources attaching within a VPC two requirements
must be met.

1) A fully functioning VPC with a minimum of two private subnets spread over two availability zones is required. In addition
1) A fully functioning VPC with a minimum of two private subnets spread over two availability zones is required.
These private VPC subnets should have access to AWS services. This can be accomplished using NAT Gateway with proper IGW
configuration / routing. Other third party gateway implementations can be used that provide access to AWS services.

2) A pre-configured VPC security group that
1) allows inbound connections on port 443 from other addresses in the VPC CIDR block. For example,
if the VPC's CIDR block is 10.178.0.0/16, inbound connections in the security
Expand Down Expand Up @@ -55,4 +67,3 @@ VPN or Direct Connect to the VPC.

* The API Gateway used by the Designer UI is still available publicly and access is
still authorized using Cognito. The Lambda's backing the API will run within the VPC.

53 changes: 53 additions & 0 deletions docs/connect_callback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# New Connect Callback Example

New example demonstrating how QnABot can be asked by a user for a live agent based phone callback. The
implementation provides a new LambdaHook example as well as four sample questions that ask a user for
their name and phone number prior to handing off to an Amazon Connect instance to initiate the callback.

**Two configuration updates are required to use this example with Amazon Connect.**

The IAM Role/Policy used by the ConnectCallback Lambda must include a new policy that allows
the action "connect:StartOutboundVoiceContact" to be used with the resource
`"arn:aws:connect:*:*:instance/<YourConnectInstanceId>/*"`. The following is an example of this policy

```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "connect:StartOutboundVoiceContact",
"Resource": "arn:aws:connect:*:*:instance/<YourConnectInstanceId>/*"
}
]
}
```

1) Find the Lambda ConnectCallback Function in the AWS Lambda Console
2) Open the AWS Console and select the Lambda Service
3) In the Console's filter enter 'ConnectCallback' and press enter
4) The displayed function will start with `<stackname>-ExamplePYTHONLambdaConne...` If you have multiple QnABot stacks
installed you'll see multiple functions listed
5) Open the Lambda function by clicking on the function
6) Select the Permissions tab
7) Click on the Role name to open this Role in a new tab
8) Click on + Add inline policy
9) Select the JSON tab
10) Copy the sample text above, paste as JSON, and change `<YourConnectInstanceId>` to the Instance ID identified in the Connect Console.
11) Click on Review policy
12) Enter a name for the policy and click Create policy

You've now enabled Lambda functions using this role to start outbound calls via the connect instance

Lambda Hook Arguments need to be updated. Before being used, the item with qid CONNECT_TO_AGENT.04
should have its Arguments field adjusted to reflect identifiers from the Connect instance:

```bash
"AWS_connect_instance_id": "<your-connect-instance-id >",
"AWS_connect_contact_flow_id": "<your-connect-contact-flow-id>",
"AWS_connect_queue_id": "<your-connect-queue-id>",
```

Once these configuration changes are in place, QnABot can be successfully use Amazon Connect to place
outbound calls.
105 changes: 105 additions & 0 deletions docs/multilanguage_support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# MultiLanguage Support

QnABot version 2.6.0 supports use of multiple languages with these limitations:

- MultiLanguage support for voice is limited to use with Alexa skills only. (Amazon Lex currently supports voice recognition in English only)
- MutiLanguage support for text is available via all text clients (e.g. Lex Web UI, SMS, etc.)

####Lex (text mode only):

If the user enters a question in a language other than english, QnABot will attempt to return an answer in the other language.
It does this by using Amazon Comprehend to identify the language typed. If Comprehend can identify the language based on a configured minimum confidence,
QnABot will serve up content based on that locale.

Users can also set a preferred language whereby QnABot will always attempt to respond with content in the chosen
locale. If the user sets the preferred language to be Spanish, QnABot will always try and serve up content using
Spanish when possible.

## Alexa (voice)

You will need to add each language you want to use to your QnABot skill using the Alexa Developer console. The intent schema for each
language will be identical except for the skill invocation name. Give the skill a unique invocation name for each language that you add.

QnABot will use the language setting provided by Alexa, and will attempt to respond in that language.

## How it works

QnABot converts the question posed by the user to English, using Amazon Translate, and performs a lookup of the answer in Elastic Search
just as it normally does, using the English translation of the question. ElasticSearch searches are done in English only since QnABot documents
are indexed using the English text analyzer (stemming, stop words, etc.)

To ensure good matching of translated questions, you can use the Amazon Translate console to see the English translation of your local language question. Use QnABot content designer
to ensure your QnA item has the right sample questions to ensure a match.

Once it finds the question, QnABot will serve up the configured answer.

You can use Handlebar blocks to define explicit answers in each different language you want to support. OR, if you do not
explicitly define an answer in the user's language, QnABot will automatically use Amazon Translate to convert the default English.
answer to the target language.

## Configuration

By default this feature is disabled. Use the following three steps to enable and configure this feature. Step 1 enables the feature. Step 2 loads in two questions from this extension that allow the user to select a preferred language. The defaults supplied in this question are English, Spanish, French, German, and Italian. You can extend this list to
support other languages.

Step 1) Enable multi language support

a) QnABot uses a property named ENABLE_MULTI_LANGUAGE_SUPPORT, default value of "false".
You can change this setting using the Content Designer Settings page. Set it to "true" to enable multi language support.

Step 2) Use the Designer UI to import the Sample/Extension named Language / Multiple Language Support.

This will add two questions to the system: Language.000 and Language.001. When using Lex text clients, these questions will allow you to set your preferred language.
The preferred language, if set, will take precedence over
the auto detected language.

_When using Alexa, the language is automatically set by the skill. You will not be able to override the preferred language when using Alexa._

Language.000 provides a question that allows the user to set the current sessions preferred output saying a simple word
such as French, German, or Spanish, or Italian.

Language.001 resets the preferred language. This can be performed by saying or typing 'reset language' or 'detect language'.
You can also input using your language of choice assuming AWS Translate can translate the input back to English.

Once you've imported this extension question try typing the question 'Spanish'. You should see a Spanish response.

Next enter 'English' and you will have switched your preference back to English.

Next enter 'reset language' and your preference will be reset and language auto detection will occur again.

The answer for Language.000 uses the following handlebar syntax

```handlebars
{{#setLang 'fr' false}} D'accord. J'ai défini votre langue préférée sur l'anglais. {{/setLang}}
{{#setLang 'es' false}} Okay. He configurado tu idioma preferido al inglés. {{/setLang}}
{{#setLang 'de' false}} In Ordnung. Ich habe Ihre bevorzugte Sprache auf Englisch eingestellt. {{/setLang}}
{{#setLang 'it' false}} Ok. Ho impostato la tua lingua preferita sull'inglese.{{/setLang}}
{{#setLang 'en' true}} Ok. I've set your preferred language to English. {{/setLang}}
```

The helper function setLang performs the necessary processing to set the preferred language/locale for the session. To
add support for other languages just extend the answer in Language.000 with additional locales.

Step 3) In order to serve up content that is locale specific you can

- allow QnABot to automatically translate your english answers to the session language using Amazon Translate.
- OR provide explicitly curated answers in QnA items, in multiple languages, using handlebars, as shown below.

Lets modify the question sun.1. The following would be an example where the handlebar function ifLang is used to specify a response for Spanish.

Use the handlebar template defaultLang to specify the response QnABot should provide when the language is unknown. By
default this is typically in English but could be in any language as needed.

`{{#defaultLant}}{{/defaultLang}}` must be the last element in the answer block.

```handlebars
{{#ifLang 'es'}}
Nuestro sol tiene 4.600 millones de años. Se considera una enana amarilla con un diámetro de 1,392,684 kilómetros y una circunferencia de 4,370,005 kilómetros. Tiene una masa que es igual a 333,060 tierras y una temperatura superficial de 5,500 grados centígrados. ¡Muy caliente!
{{/ifLang}}
{{#defaultLang}}
Our sun is 4.6 billion years old. Its considered a yellow dwarf with a diameter of 1,392,684 kilometers and a circumference of 4,370,005 kilometers. It has a mass that is equal to 333,060 earths and a surface temperature of 5,500 degrees celsius. Really Hot!
{{/defaultLang}}
```

The handlebar function ifLang takes locale as a quoted parameter. This tells QnABot which locale to associate with the subsequent
text.
37 changes: 37 additions & 0 deletions docs/overview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Overview

Chatbots are a great way to make information available for your users. With QnABot you can deploy a chatbot in just a few steps and have a fully functional chat experience setup in under an hour.


Once the solution is deployed, you have a QnABot designer console where you can build and manage your question and answer bank. The question and answer bank become your knowledge base and the main source of information for QnABot to interact with to provide users' with relevant answers.

## Solution architecture and how It works

Three key AWS services are at the core of the solution:

- **Amazon Lex** is a service for building conversational interfaces into any application using voice and text. Amazon Lex provides the advanced deep learning functionalities of automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize the intent of the text to enable you to build applications with highly engaging user experiences and lifelike conversational interactions.
- **Amazon ElasticSearch** is an open-source search and analytics engine for use cases such as log analytics, real-time application monitoring, and clickstream analysis. Amazon ElasticSearch is a managed service that makes it simple to deploy, operate, and scale Elasticsearch clusters in the AWS Cloud. The service offers open-source Amazon ElasticSearch APIs, managed Kibana, and integrations with Logstash and other AWS services, enabling you to securely ingest data from any source and search, analyze, and visualize it in real time.
- **Amazon Kendra** is an intelligent search service powered by machine learning. Kendra reimagines enterprise search for your websites and applications so your employees and customers can easily find the content they are looking for, even when it’s scattered across multiple locations and content repositories within your organization.

Let's take a closer look at these three services and how they help power
the QnABot solution.

![Solution architecture and data flow](image2.png)

When you ask QnABot a question, a few things happen:

1. The question gets processed and transcribed by Amazon Lex using a Natural Language Understanding (NLU) and Processing (NLP) engine.
- QnABot initially trains the NLP to match a wide variety of possible questions and statements, so that the Amazon Lex bot can accept just about any question a user might ask. The Amazon Lex interaction model is setup with:
- **Intents**: An intent represents an action that fulfills a user's spoken request. Intents can optionally have arguments called **slots**. The QnABot uses **slots** to capture user input and fulfills the Intent via Lambda function.
- **Sample utterances**: A set of likely spoken phrases mapped to the intents. This should include as many representative phrases as possible. The sample utterances specify the words and phrases users can say to invoke your intents. QnABot updates the **Sample utterances** with the various questions to train the chatbot to understand different user input
2. The Bot fulfillment Lambda function generates an ElasticSearch query containing the transcribed question. The query attempts to find the best match from all the questions and answers you’ve previously provided.
3. This request is then sent to Amazon ElasticSearch. QnABot attempts to match a user's question to the list of questions and answers (created in the QnABot content designer) stored in Amazon ElasticSearch.
4. (Optional) If an answer is not found in ElasticSearch and Amazon Kendra is configured, QnABot will search documents or web pages in your Kendra index.

## Monitoring Usage

![Kibana Dashboard](image9.png)

QnABot includes a visualization tool (using Kibana) to analyze QnABot usage. Kibana is an open-source data visualization and exploration tool used for log and time-series analytics, application monitoring, and operational intelligence use cases. It offers powerful and easy-to-use features such as histograms, line graphs, pie charts, heat maps, and built-in geospatial support. Also, it provides tight integration with Elasticsearch, which makes Kibana the default choice for visualizing data stored in Elasticsearch.

The Kibana dashboard can be used to view usage history, logged utterances, no hits utterances, positive user feedback, and negative user feedback and also provides the ability to create custom reports.
Binary file added docs/overview/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/overview/image9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/redact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Optional Redact feature for log and metric output

QnABot can be configured to redact information written to CloudWatch logs, S3 metrics, and Kibana metrics logs.
This feature is disabled by default. Use the Designer UI Settings form to enable this feature. One can configure
the RegEx applied to strings as they are logged. If RegEx matches are found, the match is replaced with the string
'XXXXXX'.

The initial RegEx is

```regex
\b\d{4}\b(?![-])|\b\d{9}\b|\b\d{3}-\d{2}-\d{4}\b
```

This replaces 4 digit numbers not followed by a hyphen, a 9 digit number (SSN without hyphens), and a typical
SSN using nnn-nn-nnnn syntax with hyphens.
2 changes: 0 additions & 2 deletions test-do-not-use-obsolete/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions test-do-not-use-obsolete/Makefile

This file was deleted.

15 changes: 0 additions & 15 deletions test-do-not-use-obsolete/README.md

This file was deleted.

1 change: 0 additions & 1 deletion test-do-not-use-obsolete/alexa/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions test-do-not-use-obsolete/alexa/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions test-do-not-use-obsolete/alexa/assets/en-US.json

This file was deleted.

41 changes: 0 additions & 41 deletions test-do-not-use-obsolete/alexa/assets/skill.json

This file was deleted.

12 changes: 0 additions & 12 deletions test-do-not-use-obsolete/alexa/create.sh

This file was deleted.

9 changes: 0 additions & 9 deletions test-do-not-use-obsolete/alexa/run.sh

This file was deleted.

Loading

0 comments on commit e5ad7da

Please sign in to comment.