Skip to content

Code samples related to "Creating a Question and Answer Bot with Amazon Lex and Amazon Alexa", published on the AWS AI Blog. QnABot (pronounced “Q and A Bot”), uses Amazon Lex and Amazon Alexa to provide a conversational interface to your “Questions and Answers”, so users can just ask their questions and get quick and relevant answers.

License

Notifications You must be signed in to change notification settings

AllAboutAI/aws-ai-qna-bot

 
 

Repository files navigation

A Question and Answer Bot Using Amazon Lex and Amazon Alexa

Build a chat bot to answer questions.

Overview

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,

Prerequisites

  • 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.

Getting Started

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

Components

CloudFormation Templates

The CloudFormation test templates are in the templates/test folder. The current templates are:

  1. Master: the template contains all the resources for QnABot.
  2. 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
  3. 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

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

Web Interface

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.

Designer UI Compatibility

Currently the only browsers supported are:

  • Chrome
  • FireFox
    We are currently working on adding Microsoft Edge support.

Built With

License

See the LICENSE.md file for details

About

Code samples related to "Creating a Question and Answer Bot with Amazon Lex and Amazon Alexa", published on the AWS AI Blog. QnABot (pronounced “Q and A Bot”), uses Amazon Lex and Amazon Alexa to provide a conversational interface to your “Questions and Answers”, so users can just ask their questions and get quick and relevant answers.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 83.0%
  • Vue 9.3%
  • Python 3.6%
  • Shell 1.2%
  • HTML 1.1%
  • CSS 1.0%
  • Other 0.8%