Why do we need a framework for bots?
The Botframework was created to allow a bot application to be written once (in .NET or NodeJs) and work in many different places where you would write a bot such as:
- Facebook Messenger
The apps you write using the Botframework are called over HTTP, which makes it more accessible. Microsoft have built some integrations for each of the different places listed above so they can take the message, send it via their protocol of TCP etc, go via the Botframework and communicate with your app via HTTP. So they created an abstraction layer which makes things really simple.
Bots are basically Console applications
They accept messages which, if they can understand them, they will call the relevant method or next step of the workflow, and then usually give a message back to the user. This is all well and good if you know exactly what the command is for the application to run the method you want it to.
In most console applications, if you enter a command it doesn't understand, it will display a list of commands you can enter, with a description of what they are for.
You might be thinking nothing exciting or new here, and you would be right, until I tell you about how you can give your Bot Artificial Intelligence.
What do you use it for?
With LUIS you can take the messages written in natural language from your user, send it to LUIS and it will tell you what they mean. Then you can use what they actually meant to progress in the application.
How does LUIS know what the user means?
You can train LUIS to understand many different ways of asking something. From what it has learned, it has its best guess at what it thinks you meant, and gives scores of how sure it is against all of the possible intents that it has been trained on.
I created a demo for insurance self service. The user says something like, I want to make a payment, LUIS works out that they want to make a payment so it returns back the intent I called MakePaymentToAccount. Now my console application can start asking the user for their card details etc.
How much does LUIS cost?
LUIS is free if you are doing less than 10,000 requests per month. If you need more than that, it costs $0.75 per 1,000 requests.
It's so easy to get started, and the opportunities with it are endless.
Get training your own AI application
Go to http://www.luis.ai/ sign in with your microsoft account and start creating your own LUIS application.
You could do an intelligent FAQs or a product selector, or common faults application.
Here's some code for you to call your LUIS application, just enter LUIS applicationId and key in and you will be up and running. You will be able to ask it questions and see what it thinks you meant. Then change what you want to say in the switch statement which looks at the response from LUIS.
Mine won't work for you because I didn't want to give away my applicationId or key. If you enter your application details in, you will be able to test it out.
Spread the word
Please share this article with others. Feel free to ask questions in the comments too.
A .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.