Skip to content

Commit 154cd58

Browse files
committed
Updated documentation.
1 parent 81594a6 commit 154cd58

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

Instructor.md

+14
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,17 @@ Create the following IAM role that users will associate with their Lambda functi
3232
```
3333

3434
- Trust relationship: lambda.amazonaws.com
35+
36+
## Resources Required
37+
Below are the resources required in the AWS account that will be created. All are per student unless noted otherwise
38+
39+
- 1 Lambda Function
40+
- 1 Lex Bot
41+
- 1 Custom Intent
42+
- 4 Custom Slot Types
43+
- 1 Lambda IAM Role (can be used for all students)
44+
- 1 CloudWatch Logs Group
45+
46+
47+
## Other Note
48+
Users are optionally given instruction for creating a mobile application or web app which can be used to integrate Amazon Polly for voice into the solution, if they choose to do so they will need access to Cognito, the Amazon Mobile Hub, an Android Device, and to setup a local Android SDK. If they choose to use the example for a website, they will need an IAM user with access to the Lex bot.

README.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# amz-ai-building-better-bots
2-
Code samples related to [Building Better Bots](https://aws.amazon.com/blogs/ai/building-better-bots-part-2/) published on the AI Blog
1+
# Introduction
2+
3+
This workshop walks through the steps of creating an interactive chat bot using the AWS Lex and Polly services.
34

45
# CoffeeBot
56

@@ -78,6 +79,7 @@ Let me get a {BeverageSize} {Creamer} {BeverageType}
7879

7980
Add the following Slot types (each value should be a separate entry); remember to "Save slot type" as you go along.
8081
To work independently in a shared environment, use your initials in the names (e.g., `cafeBeverageTypeXXX`).
82+
8183
Note: Although they are saved with the AWS Account, ***Slot Types will only show up in the list on the left when they are associated in the next step.***
8284

8385
Slot type name | Description | Values (each entry on a separate line)
@@ -110,18 +112,23 @@ Once built, a new panel will appear on the right of the Amazon Lex Console where
110112
## Lambda Function
111113
Now that we've tested that our application works, let's add more logic to validate our choices and handle the processing of the order.
112114

115+
![Lambda](/images/lambda.png)
116+
113117
1. Create the `cafeOrderCoffee` function by saving `cafeOrderCoffee_lambda.js` as a Node.js 6.10 function
114118
- To work independently in a shared environment, use your initials in the function name (e.g., `cafeOrderCoffeeXXX`)
115-
- You can get the function source [here](https://github.com/awslabs/amz-ai-building-better-bots/blob/master/src/index.js)
119+
- You can get the function source [here](/src/index.js)
116120
- (No need to set up a trigger; you can accept default values for most of the configuration)
117-
- Choose an IAM role that includes the `AWSLambdaBasicExecutionRole` Managed Policy. If no such role exists, you can create a new IAM Role using one of these approaches:
118-
- Choose "Create new role from template(s)", provide a role name, and choose `Basic Lambda permissions` from the "Policy templates" dropdown
119-
- Choose "Create a Custom role", which should open up a new tab where an IAM role is shown; review the policy document and click "Allow"
121+
- Choose an IAM role that includes the `AWSLambdaBasicExecutionRole` Managed Policy. There may already be one named `coffeebot-lambda-role`
122+
- If no such role exists, you can create a new IAM Role using one of these approaches:
123+
- Choose "Create new role from template(s)", provide a role name, and choose `Basic Lambda permissions` from the "Policy templates" dropdown
124+
- Choose "Create a Custom role", which should open up a new tab where an IAM role is shown; review the policy document and click "Allow"
120125
1. Configure the Test event and test to confirm the function works as expected (see `cafeOrderCoffee_test.json`)
121-
- you can get the event source [here](https://github.com/awslabs/amz-ai-building-better-bots/blob/master/test/cafeOrderCoffee_test.json)
126+
- you can get the event source [here](/test/cafeOrderCoffee_test.json)
122127
1. You'll notice that the function checks the bot name it receives (``if (event.bot.name !== 'CoffeeBot')``); remember to change this value in the function and in the test event to match the name you used for your bot
123128

124129
## Test the bot
130+
Navigate back to the Amazon Lex console to reconfigure your bot to use the Lambda function for validation.
131+
125132
1. From the Lex Console, select the `CoffeeBot` bot and choose `Latest` from the version drop down to make changes
126133
1. Modify the `cafeOrderBeverageIntent` Intent
127134
- Add `Thanks for choosing PressoBot!` as the "Goodbye message"
@@ -132,8 +139,10 @@ Now that we've tested that our application works, let's add more logic to valida
132139
1. Build the bot
133140
1. Test using the Amazon Lex Console; do you see any responses when you ask `May I have a mocha?`
134141

135-
## Android App
136-
Now, let's build this voice bot through an Android App that talks to you using Amazon Polly and Amazon Lex.
142+
## Android or Web Application
143+
If you'd like to explore further, you can integrate your Amazon Lex bot with an Android application or a web page.
144+
145+
### Android Application
137146
You'll need the following in addition to your AWS account:
138147
- Android development environment ([download](https://developer.android.com/sdk))
139148
- To test voice (you can use the simulator for text)
@@ -145,3 +154,11 @@ You'll need the following in addition to your AWS account:
145154
1. Add the "Conversational Bots" feature to the project. When prompted, import `CoffeeBot`. Mobile Hub takes care of a number of important details behind the scenes. A new Amazon Cognito Federated Identity Pool is created for this new app along with roles so that the users can interact with Lex (using voice and text).
146155
1. Source code for the new app is immediately available for download.
147156
1. Follow the instructions in the `READ_ME/index.html` file to setup, compile, and run the app.
157+
158+
### Web Application
159+
160+
Using the AWS SDK for Javascript, you can integrate your Amazon Lex bot in a web page that will both capture and return audio to your end users.
161+
162+
[This article on the machine learning blog](https://aws.amazon.com/blogs/machine-learning/capturing-voice-input-in-a-browser/) will walk you through the steps to setup this integration. When using the Lex PostContent API call, you will pass the name of your deployed bot as a parameter.
163+
164+
You can also use the native integrations to connect your bot to Facebook Messenger, Slack, Twilio, and Kik.

images/chat_window.png

13.8 KB
Loading

images/lambda.png

45.1 KB
Loading

0 commit comments

Comments
 (0)