Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal

Use your voice to play a song, artist, or genre through Amazon Music, Apple Music, Spotify, Pandora, and others. With compatible Echo devices in different rooms, you can fill your whole home with music.

Buy Now

Wireless Rechargeable Battery Powered WiFi Camera.

Wireless Rechargeable Battery Powered WiFi Camera is home security camera system lets you listen in and talk back through the built in speaker and microphone that work directly through your iPhone or Android Mic.

Buy Now

How to build a chatbot in 15 minutes or less

0
67


Edward Leoni
Source

Yes, you read it right! If you follow this article, you can build your own functional chatbot in under 15 minutes!

The final result is something like this:

Oh, and full disclosure: You will only type 11 lines of code to build this incredibly simple but reasonably scalable bot. Excited yet?

If you are new to Amazon Lex, you can try it for free. From the date you get started with Amazon Lex, you can process up to 10,000 text requests for free for the first year, after that it costs $0.00075 per text request, what that means is that you will pay $0.38 — yes thirty-eight cents — at every five hundred times your bot is texted. Very friendly pricing, no doubts.

Now go create that AWS account if you don’t have one, and if you do, go log in, I’ll be waiting here! But fast! We only have 15 minutes, remember?

Now look for Lex within the services tab, should look something like this:

Click on “Create” to create a new bot, the configuration of your bot should be as follows

I would explain all of this but we’re running against the clock here! Some highlights:

Output voice — Amazon Lex allows you to create more than text-based bots. You can automate entire call centers with it!

Try a sample — These samples are a very good way to get acquainted with the different features you can use.

I strongly recommend you come back later to try these different settings, for now, let’s keep moving!

Once you created your bot, let’s create our intent. Intents are the essentially the things you bot can understand, the more intents, the more things your bot can talk about. Since this is a bot that understands politics, let’s create our “trump” intent:

Utterances are essentially the different ways you can ask the same thing. Amazon Lex will take care of small variants and typos for you. What that means is that you don’t have to worry about your bots phrasing like “what u think of trump?“, Lex will make sure the bot understands that too.

So after you put the above utterances in, let’s make sure the bot can reply to them by scrolling down and filling the responses, like so:

Boom! Save the intent and your bot is now capable of talking about politics. Well, about Trump anyways. You will notice there’s an area on the right within Amazon Lex that allows you to test your bot. To test what we have just done, you will need to “Build” your bot first, so make sure you hit that button before testing it out! The test should look something like this:

We’re going to start coding your bot now so that it works outside Amazon’s dash! But first, there are a couple things we still need to do. The first one is publishing your bot. You can play around with your bot as much as you want, but your customers will only see these changes after you publish it. The publishing button is just beside the “build” button. You will be asked for an “alias”, an “alias” could be things like “production_environment” or “test_environment”. Let’s just name it “politicsbot” for now.

The last thing we need to do is to generate API keys for our application to access the bot.

Chop Chop! On Amazon, head to services again and look for “IAM”. Click on “Users” and add a new one. Name it “bot_user” and select the access type to “programatic”. Like so:

Great! We’re almost there. When asked about permissions, select “attach existing policies directly” and select “AmazonLexFullAccess”.

Hit create user! Save the “Access Key ID” and “Secret Access Key” given to you as we will use it soon.

You must be thinking “There is just no way we will make it in time!”. Well, remember I said all it takes to get this working is 11 lines of code?

To run this, create a python file named “bot.py” and run it by typing

python bot.py <aws_key_id> <aws_key_secret>

The only requirement is to have “boto3” installed, boto3 is Amazon’s Python library, install it by typing “pip install boto3”.

The code above is only compatible with Python 3.

So… DID YOU MAKE IT IN TIME?

I recommend you start playing around with Amazon Lex, add some more intents, make your bot really smart!

Alternatively, you can take my course on Udemy or read Amazon’s documentation which is full of useful information, it’s available in Kindle, PDF and other formats.



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here