This repository contains the examples and slides of the demo given at the bootcamp session on 27th of April 2019.
The goal of the demo is to showcase how easy it is to create a bot from scratch with the Microsoft BotFramework SDK. We also do a basic integration with the LUIS (Language Understanding) AI service and throw in some AI calls to Microsoft Computer Vision. Everything can be setup and run for free (based on the load, but for small projects you will be fine). If you don't have an Azure account, get one for free.
If you have any questions, feel free to open a new issue.
Browse to the LUIS portal (is region specific, we use EU), login with your account and create a new application.
Then navigate to intents under Build and create a new one named ´Registration´
Then click the intent and create some utterances. The utterance is what you would expect the user to send to the bot to end up with this intent. So the intent the user has with his input.
After that, you can create an entity by hovering your previously created utterance. We create a new simple entity named eventType
. The entity extracts data from the utterance that is predictable.
Let's train the app, so LUIS is up to date of all the changes we were making. You always need to train the app before you can test it.
After training, let's test what we created so far. You should see that an utterance craeted before should match the Registration
intent. It could also match the entity eventType
if it contains an event type. Also try with utterances that are related but not a direct match in LUIS, it should give a lower score.
When we want to use the LUIS functionality out of the portal, we should publish it to a slot. We can publish to Production and to Staging. If we publish to staging we need to add this parameter in the API request, so for this example we can just publish to Production.
If you want to use your cognitive resource from Azure and link it to your LUIS app so it can use that plan, you should first create a LUIS resource in Azure.
After that, you might want to relogin in LUIS and when you're using the same account as in the Azure Portal, you can link them.
To kickstart our project, we use the scaffolding templates provided by BotFramework. To use this, you can install the VSIX package.
Create a new project using the EmptyBot
option template
Run the bot by pressing F5 in Visual Studio, you should see something similar like this
Use the snippets in the snippets folder in this repository. We are editing the Startup class, your bot class and the appsettings file.
Download and install the latest BotFramework emulator. Open the .bot file in the emulator that got created in the project.
Create a new Computer Vision resource in Azure.
Create a new Bing Spellcheck v7 resource in Azure.
Enable Bing Spellcheck in LUIS. This is just a switch, you will use the spellcheck authorization key in the API call.
To use the bot in the cloud, you will have to provision a bot channels registrations in Azure. In the registration you can configure the channels (facebook, slack, web, ...) that the bot will be accessible from. Make sure you configure the endpoint in the settings page. The endpoint contains the address to the bot messages API that will be called when a user starts talking to the bot.
The easiest is to directly create a new Microsoft App, it will handle the security of your bot.
While preparing this demo, I've create an automated testing tool that was already some time in the back of my head. You can read more about it