This course focuses on how to use the LUIS (Language Understanding Intelligent Service) portal to create new LUIS models, how to enrich them with intents, entities, and utterances, and how to train and apply apps.
Not only will you get theoretical knowledge of LUIS and its components, but you'll also follow along with demonstrations from the LUIS portal to get a practical understanding of how to use the service.
Learning Objectives
- Obtain a general understanding of what LUIS is and how to interact with it
- Create LUIS resources
- Learn about utterances, intents, and entities and how they are used in language understanding at a practical level
- Learn how to test, train, and publish your LUIS models
Intended Audience
This course is made for developers or architects who would like to know more about how to use the Language Understanding Intelligent Service, LUIS, to improve their chatbot development and experience.
Prerequisites
To get the most out of this course, you should have some Azure experience, particularly surrounding subscription and resource groups as well as chatbots and language services. Some developer experience, including familiarity with terms such as REST API and SDKs, would also be beneficial.
Let's start with a general overview of what LUIS is, and how it can help your bot applications. LUIS, or Language Understanding Intelligent Service, is a custom Azure Cognitive Services API that allows you to train computers to understand natural language, so that you don't have to code multiple variations of the same sentence. For example, the sentences, "Book me a car for LHR," and "I want to reserve a sedan for London Heathrow," probably mean the same thing, that you want to make a car reservation for the London Heathrow Airport. LUIS figures this out through utterances, intents and entities.
Utterances are the sentences that you're sending to the model, for example, "Book me a car for LHR." Intents are the actions you want to perform, and they're often identified by the verb in a sentence, in this case, reserve or book could be mapped to a car reservation intent.
Entities are what you're intending to perform the action upon, and are generally represented by nouns, such as the subject or the object of the sentence, in this case, the London Heathrow Airport. One of the great advantages of using LUIS is that the model uses machine learning to improve over time, based on the utterances given. Therefore, the more you use LUIS, the more accurate the results will be.
As with anything in Azure Cognitive Services, LUIS is accessible through a REST HTTP endpoint, and returns the results are in a JSON format. When you, or more commonly your bot, send an utterance to LUIS, the response will have an array of intents and entities, as well as optionally the confidence level of each possible answer, like you see on the screen.
First, we have the query itself, the utterance which generated this JSON response, in this case, the sentence, "Book me a table for 5 people at 6 PM tomorrow." Then, we have the top intent that was detected by LUIS, in this case, the most relevant intent is RestaurantReservation.Reserve.
Next, we have an array of all possible intents, along with the confidence level of each one, they range from zero to one, and the closer to one, the higher the confidence in the results. I actually filtered out some the other intents, so that the full JSON code can fit on the slides. You can use the query parameter show-all-intents=false for that. However, showing all intents might be valuable information for you.
For example, if the difference between the confidence levels of the top two intents was low, you could build some confirmation logic in your application to check what the user wants, "Do you want to make a new reservation, or change an existing one?"
Finally, we have all the possible entities that were detected by LUIS. The service actually did a pretty good job here, and detected five as the number of people, and 6 PM tomorrow as the time. Notice that there are no confidence levels for entities. That's the default behavior in version 3.0 of the API, the older version, 2.0, used to show them. However, you can still see the confidence scores for entities by setting the parameter Verbose = True when you're making the REST API call.
For details about how to construct the API request and the type of JSON data you're going to receive, you can visit aka.ms/luis-api-v3. We'll have the chance to see the API documentation page in a later demo.
As I mentioned on a previous slide, LUIS is a Custom Cognitive Services solution, which means that you can interact with the model and train that according to your needs. As is common with Custom Cognitive Services, this model training is done by using a dedicated portal, which can be accessed from www.luis.ai.
Keep in mind that, if you're looking at an older documentation, you might see references to regional LUIS sites for Europe, eu.luis.ai, and Asia Pacific, au.luis.ai, but Microsoft is now consolidating everything into just one LUIS portal. The portal is your main way of configuring and interacting with LUIS, allowing you to do things such as create, delete, import and export apps, add intents, entities, utterances and prebuilt domains, configure and monitor your apps, and train, test and publish your models.
The LUIS App can also be created through code. This article here, covers how to use C# or Python to create a LUIS app in the portal. That being said, you also need to create the LUIS resource in your Azure subscription, and you will more commonly do so on the Azure portal. When you're creating the LUIS resource, you end up having two endpoints.
The first one is for Authoring. This endpoint allows you to author, publish, manage, collaborate and version your LUIS apps, both programmatically and through the LUIS portal. In a way, you can consider this to be your development endpoint. The other one is the Prediction endpoint, which will be used by your apps and bots to access a LUIS model that already has been published. In a way, you can consider this your production endpoint. Technically, you can use the Authoring endpoint for Prediction as well, however, you're limited to a maximum of 1000 requests, which will probably not be enough for production deployments.
Let's jump into a demo to see how to both create the LUIS Azure resource and our first LUIS app.
Emilio Melo has been involved in IT projects in over 15 countries, with roles ranging across support, consultancy, teaching, project and department management, and sales—mostly focused on Microsoft software. After 15 years of on-premises experience in infrastructure, data, and collaboration, he became fascinated by Cloud technologies and the incredible transformation potential it brings. His passion outside work is to travel and discover the wonderful things this world has to offer.