Build a chat bot to answer questions.
This repository contains code for the QnABot, described in the AWS AI blog post “Creating a Question and Answer Bot with Amazon Lex and Amazon Alexa”.
See the "Getting Started" to launch your own QnABot,
- Run Linux. (tested on Amazon Linux)
- Install npm >5 and node >8. (instructions)
- Clone this repo.
- Set up an AWS account. (instructions)
- Configure AWS CLI and a local credentials file. (instructions)
Note: Lex is currently only supported in the us-east-1 and eu-west-1 regions.
First, install all prerequisites:
npm install
Next, set up your configuration file:
npm run config
now edit config.json with you information.
param | description |
---|---|
region | the AWS region to launch stacks in |
profile | the AWS credential profile to use |
namespace | a logical name space to run your templates in such as dev, test and/or prod |
devEmail(required) | the email to use when creating admin users in automated stack launches |
Next, use the following command to launch a CloudFormation template to create the S3 bucket to be used for lambda code and CloudFormation templates. Wait for this template to complete (you can watch progress from the command line or AWS CloudFormation console)
npm run bootstrap
Finally, use the following command to launch template to deploy the QnA bot in your AWS account. When the stack has completed you will be able to log into the Designer UI (The URL is an output of the template). A temporary password to the email in your config.json:
npm run up
If you have an existing stack you can run the following to update your stack:
npm run update
The CloudFormation test templates are in the templates/test folder. The current templates are:
- Master: the template contains all the resources for QnABot.
- Public: this is a version of the Master template with less parameters, less outputs, and the bootstrap bucket hardcoded to the publicBucket in config.json
- various templates in /templates/dev: needed for local testing of the lambda functions.
Run a template test with:
npm run stack test/{template-name}
For example, if you want to test the domain template run:
npm run stack test/domain
To understand the command more run:
npm run stack -h
You also can check a template's syntax with:
npm run check {template-name}
ex.
npm run check domain
To understand the command more run:
npm check stack -h
Lambda functions are found in the /lambda directory. Refer to the README.md file in each directory for instructions on setting up a dev environment and testing. Fulfillment CFN Lex-Build Import
The Designer UI and client UI code is in the /website directory.
To Test the web ui, Launch a development master stack:
npm run stack dev/master up
when that stack has finished run:
cd ./website ; make dev
this will launch a running webpack process that will watch for changes to files and upload the changes to your running dev/master stack.
Currently the only browsers supported are:
- Chrome
- FireFox
We are currently working on adding Microsoft Edge support.
See the LICENSE.md file for details