You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Instructor.md
+14
Original file line number
Diff line number
Diff line change
@@ -32,3 +32,17 @@ Create the following IAM role that users will associate with their Lambda functi
32
32
```
33
33
34
34
- 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.
Copy file name to clipboardExpand all lines: README.md
+26-9
Original file line number
Diff line number
Diff 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.
3
4
4
5
# CoffeeBot
5
6
@@ -78,6 +79,7 @@ Let me get a {BeverageSize} {Creamer} {BeverageType}
78
79
79
80
Add the following Slot types (each value should be a separate entry); remember to "Save slot type" as you go along.
80
81
To work independently in a shared environment, use your initials in the names (e.g., `cafeBeverageTypeXXX`).
82
+
81
83
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.***
82
84
83
85
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
110
112
## Lambda Function
111
113
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.
112
114
115
+

116
+
113
117
1. Create the `cafeOrderCoffee` function by saving `cafeOrderCoffee_lambda.js` as a Node.js 6.10 function
114
118
- 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)
116
120
- (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"
120
125
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)
122
127
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
123
128
124
129
## Test the bot
130
+
Navigate back to the Amazon Lex console to reconfigure your bot to use the Lambda function for validation.
131
+
125
132
1. From the Lex Console, select the `CoffeeBot` bot and choose `Latest` from the version drop down to make changes
126
133
1. Modify the `cafeOrderBeverageIntent` Intent
127
134
- 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
132
139
1. Build the bot
133
140
1. Test using the Amazon Lex Console; do you see any responses when you ask `May I have a mocha?`
134
141
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
137
146
You'll need the following in addition to your AWS account:
138
147
- Android development environment ([download](https://developer.android.com/sdk))
139
148
- 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:
145
154
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).
146
155
1. Source code for the new app is immediately available for download.
147
156
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.
0 commit comments