Guidelines of Microsoft Tools
(as provided by Microsoft)
Microsoft Azure Bot Framework
Why use Bot Service?
Here are some key features of Bot Service:
Multiple language support. Bot Service leverages Bot Builder with support for .NET and Node.js.
Bot templates. Bot Service templates allow you to quickly create a bot with the code and features you need. Choose from a Basic bot, a Forms bot for collecting user input, a Language understanding bot that leverages LUIS to understand user intent, a QnA bot to handle FAQs, or a Proactive bot that alerts users of events.
Bring your own dependencies. Bots support NuGet and NPM, so you can use your favorite packages in your bot.
Flexible development. Code your bot right in the Azure portal or set up continuous integration and deploy your bot through GitHub, Visual Studio Team Services, and other supported development tools. You can also publish from Visual Studio.
Connect to channels. Bot Service supports several popular channels for connecting your bots and the people that use them. Users can start conversations with your bot on any channel that you've configured your bot to work with, including Skype, Facebook, Teams, Slack, SMS, and several others.
Tools and services. Test your bot with the Bot Framework Emulator and preview your bot on different channels with the Channel Inspector.
Open source. The Bot Builder SDK is open-source and available on GitHub.
Documentation - https://docs.microsoft.com/en-us/bot-framework/
BotBuilder SDK - https://github.com/Microsoft/BotBuilder
Sample: Information Bot Scenario
This Information Bot could answer questions defined in a knowledge set or FAQ using Cognitive Services QnA Maker and answer more open-ended questions by using Azure Search.
Beginners (All team members)
Quick Start guideline: https://docs.microsoft.com/en-us/bot-framework/bot-service-quickstart
Q&A Maker: https://qnamaker.ai/Documentation/quickstart
Video – Build an intelligent knowledge base with QnA Maker and Bot Service: https://channel9.msdn.com/Events/Connect/2017/T107
Online MOOC Course – Developing app: https://www.edx.org/course/developing-intelligent-apps-bots-microsoft-dat211x-2
Developers (intermediate and advanced level)
Make your bot Smarter with Microsoft Cognitive Services: https://docs.microsoft.com/en-us/bot-framework/bot-service-concept-intelligence
Connect Chatbot to Web Chat: https://docs.microsoft.com/en-us/bot-framework/bot-service-channel-connect-webchat
Online Training Course – Creating Bots in the Microsoft Bot Framework Using C#: https://mva.microsoft.com/en-US/training-courses/creating-bots-in-the-microsoft-bot-framework-using-c-17590
Microsoft Azure Web App
What is it and Why?
Azure Web Apps enables you to build and host web applications in the programming language of your choice without managing infrastructure. It offers auto-scaling and high availability, supports both Windows and Linux, and enables automated deployments from GitHub, Visual Studio Team Services, or any Git repo. Learn how to use Azure Web Apps with our quickstarts, tutorials, and samples.
Application templates - Choose from an extensive list of application templates in the Azure Marketplace, such as WordPress, Joomla, and Drupal.
Beginners (All team members)
5-minute Overview Video: https://channel9.msdn.com/Shows/Azure-Friday/Azure-App-Service-Web-Apps-with-Yochay-Kiriaty
Web App Documentation: https://docs.microsoft.com/en-us/azure/app-service/
Video – Quick deployment of a Web App with Node.js and Azure App Service: https://azure.microsoft.com/zh-tw/resources/videos/create-a-web-app-with-nodejs-and-azure-app-service/
Developers (intermediate and advanced level)
Mobile App Documentation: https://docs.microsoft.com/en-us/azure/app-service-mobile/
Language Understanding (LUIS)
What is Language Understanding (LUIS)?
Language Understanding (LUIS) is a cloud-based service that applies custom machine-learning to a user's conversational, natural language text to predict overall meaning, and pull out relevant, detailed information.
A client application for LUIS can be any conversational application that communicates with a user in natural language to complete a task. Examples of client applications include social media apps, chatbots, and speech-enabled desktop applications.
What is a LUIS app?
A LUIS app contains a domain-specific natural language model you design. You can start your LUIS app with a prebuilt domain model, build your own, or blend pieces of a prebuilt domain with your own custom information.
Prebuilt domain models include all these pieces for you and are a great way to start using LUIS quickly.
Using a LUIS app
Once your LUIS app is published, your client application sends utterances to the LUIS endpoint API and receives the prediction results as JSON responses.
In the following diagram:
Your client chatbot sends user text of what a person wants in their own words to LUIS in an HTTP request.
Your client chatbot uses the JSON response to fulfill the user's request
Example of JSON endpoint response
The JSON endpoint response, at a minimum contains the query utterance, and the top scoring intent.
"query": "I want to call my HR rep.",
"type": "Contact Type",
What is a natural language model?
A model begins with a list of general user intentions, called intents, such as "Book Flight" or "Contact Help Desk." You provide user's example text, called example utterances for the intents. Then mark significant words or phrases in the utterance, called entities.
A model includes:
intents: categories of user intentions (intended action or result)
entities: specific types of data in utterances such as number, email, or name
example utterances: example text a user enters in the client application
An intent, short for intention, is a purpose or goal expressed in a user's utterance, such as booking a flight, paying a bill, or finding a news article. You create an intent for each action. A LUIS travel app may define an intent named "BookFlight." Your client application can use the top scoring intent to trigger an action. For example, when "BookFlight" intent is returned from LUIS, your client application could trigger an API call to an external service for booking a plane ticket.
An entity represents detailed information found within the utterance that is relevant to the user's request. For example, in the utterance "Book a ticket to Paris", a single ticket is requested, and "Paris" is a location. Two entities are found "a ticket" indicating a single ticket and "Paris" indicating the destination.
After LUIS returns the entities found in the user’s utterance, the client application can use the list of entities as parameters to trigger an action. For example, booking a flight requires entities like the travel destination, date, and airline.
LUIS provides several ways to identify and categorize entities.
Prebuilt Entities: LUIS has many prebuilt domain models including intents, utterances, and prebuilt entities. You can use the prebuilt entities without having to use the intents and utterances of the prebuilt model. The prebuilt entities save you time.
Custom Entities: LUIS gives you several ways to identify your own custom entities including machine-learned entities, specific or literal entities, and a combination of machine-learned and literal.
An example utterance is text input from the user that the client application needs to understand. It may be a sentence, like "Book a ticket to Paris", or a fragment of a sentence, like "Booking" or "Paris flight." Utterances aren't always well-formed, and there can be many utterance variations for a particular intent. Add 10 to 20 example utterances to each intent and mark entities in every utterance.
Improve prediction accuracy
After your LUIS app is published and receives real user utterances, LUIS provides several methods to improve prediction accuracy: active learning of endpoint utterances, phrase lists for domain word inclusion, and patterns to reduce the number of utterances needed.
In the active learning process, LUIS allows you to adapt your LUIS app to real-world utterances by selecting utterances it received at the endpoint for your review. You can accept or correct the endpoint prediction, retrain, and republish. LUIS learns quickly with this iterative process, taking the minimum amount of your time and effort.
LUIS provides phrases lists so you can indicate important words or phrases to your model domain. LUIS uses these lists to add additional significance to those words and phrases that would otherwise not be found in the model.
Patterns allow you to simplify an intent's utterance collection into common templates of word choice and word order. This allows LUIS to learn quicker by needing fewer example utterances for the intents. Patterns are a hybrid system of regular expressions and machine-learned expressions.
Authoring and accessing LUIS
Build your LUIS app from the LUIS website or programmatically with the authoring APIs, or use both depending on the authoring need. Access your published LUIS app by the query endpoint.
LUIS provides three websites around the world, depending on your authoring region. The authoring region determines the Azure region where you can publish your LUIS app.
Learn more about authoring and publishing regions.
What technologies work with LUIS?
Several Microsoft technologies work with LUIS:
Bing Spell Check API provides text correction before prediction.
Bot Framework allows a chatbot to talk with a user via text input. Select 3.x or 4.x SDK for a complete bot experience.
QnA Maker allows several types of text to combine into a question and answer knowledge base.
Speech converts spoken language requests into text. Once converted to text, LUIS processes the requests. See Speech SDK for more information.
Text Analytics provides sentiment analysis and key phrase data extraction.
Read the Step-by-Step guide in Documentation: https://docs.microsoft.com/en-us/azure/cognitive-services/LUIS/
Start with planning and designing your app
It is important to plan your app before you start creating it in LUIS. Prepare an outline or schema of the possible intents and entities that are relevant to the domain-specific topic of your application.
Identify your domain
A LUIS app is centered around a domain-specific topic. For example, you may have a travel app that performs booking of tickets, flights, hotels, and rental cars. Another app may provide content related to exercising, tracking fitness efforts and setting goals.
LUIS offers prebuilt domains for many common scenarios. Check to see if you can use a prebuilt domain as a starting point for your app.
Identify your intents
Think about the intents that are important to your application’s task. Let's take the example of a travel app, with functions to book a flight and check the weather at the user's destination. You can define the "BookFlight" and "GetWeather" intents for these actions. In a more complex app with more functions, you have more intents, and you should define them carefully so as to not be too specific. For example, "BookFlight" and "BookHotel" may need to be separate intents, but "BookInternationalFlight" and "BookDomesticFlight" may be too similar.
It is a best practice to use only as many intents as you need to perform the functions of your app. If you define too many intents, it becomes harder for LUIS to classify utterances correctly. If you define too few, they may be so general as to be overlapping.
Identify your entities
To book a flight, you need some information like the destination, date, airline, ticket category, and travel class. You can add these as entities because they are important for accomplishing an intent.
When you determine which entities to use in your app, keep in mind that there are different types of entities for capturing relationships between types of objects. Entities in LUIS provides more detail about the different types.
A simple entity describes a single concept.
See Data Extraction to learn more about extracting the simple entity from the endpoint JSON query response. Try the simple entity quickstart to learn more about how to use a simple entity.
A hierarchical entity is a special type of a simple entity; defining a category and its members in the form of parent-child relationship.
See Data Extraction to learn more about extracting the hierarchical entity from the endpoint JSON query response. Try the hierarchical entity quickstart to learn more about how to use a hierarchical entity.
A composite entity is made up of other entities that form parts of a whole.
See Data Extraction to learn more about extracting the composite entity from the endpoint JSON query response. Try the composite entity tutorial to learn more about how to use a composite entity.
LUIS provides prebuilt entities for common types like Number, which you can use for the number of tickets in a ticket order.
See Data Extraction to learn more about extracting regular expression entities from the endpoint JSON query response.
A list entity is an explicitly specified list of values. Each value consists of one or more synonyms. In a travel app, you might choose to create a list entity to represent airport names.
See Data Extraction to learn more about extracting list entities from the endpoint JSON query response. Try the quickstart to learn more about how to use a list entity.
Regular expression entity
A regular expression entity allows LUIS to extract data from an utterance based on a regex expression.
See Data Extraction to learn more about extracting regular expression entities from the endpoint JSON query response. Try the quickstart to learn more about how to use a regular expression entity.
After getting endpoint utterances
After your app gets endpoint utterances, plan to implement prediction improvements with active learning, phrase lists, and patterns.
Patterns.any is a variable-length placeholder used only in a pattern's template utterance to mark where the entity begins and ends. Template utterances conform to proper syntax to identify entities, and ignorable text.
Create a new LUIS app with a prebuilt or custom domain.
Quickstart: Use prebuilt Home automation app
Use the app authoring process to build your LUIS app:
Build language model
Add a few training example utterances (10-15 per intent)
Test from endpoint
Once your app is published, use the authoring cycle of add features, publish, and test from endpoint. Do not begin the next authoring cycle by adding more example utterances. That does not let LUIS learn your model with real-world user utterances.
In order for LUIS to be efficient at its job of learning, do not expand the utterances until the current set of both example and endpoint utterances are returning confident, high prediction scores. Improve scores using active learning, patterns, and phrase lists.
Do and Don't
The following list includes best practices for LUIS apps:
Intelligent-Bank-Demo connecting with Bing Speech API and LUIS: https://github.com/tikyau/Intelligent-Bank-Demo/blob/master/readme.md
A use case of add sentiment analysis: https://docs.microsoft.com/en-us/azure/cognitive-services/LUIS/luis-quickstart-intent-and-sentiment-analysis
MOOC in Bot and LUIS (1 month online course): https://www.edx.org/course/conversation-as-a-platform-with-the-microsoft-bot-framework