ArrowLinkToArchivePageBlog

Improve user experience with a language understanding chatbot Language understanding chatbot

In my last two posts, I wrote about Microsoft Azure Bot Service, briefly explained how it works, and went over the configuration of a Question and Answer (QnA) chatbot. Today, I will continue this topic and present how to configure a language understanding bot hosted on the Microsoft Azure cloud platform.

KEY POINTS:
  • What is a language understanding bot?
  • How to create a language understanding bot hosted on Microsoft Azure?
  • What kinds of business cases can it help with?
  • How to integrate this bot with different channels?


Before I present the Language understanding bot configuration, I would like to quickly remind you what kinds of bot templates are available:

A language understanding bot uses natural language models to understand user intent in communication. Intents are how Language Understanding Intelligent Service (LUIS) determines what the user wants to do. For instance, if your client application is for IT support, then you will need intents such as “GetComputer” and “OrderLicense” in order to identify when your users want to perform these different tasks.

Language Understanding Intelligent Service (LUIS)

A language understanding bot is more advanced than a simple QnA chatbot. The key role here is assigned to Language Understanding Intelligent Service (LUIS). It is one of the cognitive services from Microsoft Azure that enables applications to understand what the user is saying in natural language. It can take the text provided by the user and break it down into components pointing out to intents, entities and other elements.

Key LUIS concepts

Here are some key terms associated with the LUIS service.

Intent

An intent represents the action the user wants to perform. The intent is a purpose or goal expressed in a user’s input, such as booking a flight or paying a bill. You have to define and name intents that correspond to these actions. A support app may define an intent named “GetComputer.”

Utterance

An utterance is text input from the user that your application needs to understand. It may be a sentence, like “Where can I get my computer?”, or a fragment of a sentence, like “Computer” or “Computer order”.

Entity

An entity represents detailed information that is relevant in the utterance. For instance, in the utterance “Order new computer on 25 of January”, “25 of January” is the key date. Entities which are mentioned in the user’s utterance can help LUIS choose a specific action to take in order to respond to the user’s request.

Below are some examples of intents, utterances and entities:

LUIS setup

In this post I would like to present how to set up a Support Team chatbot which uses LUIS to understand the users’ questions.

A simple language understanding bot does not require writing a single line of code. Everything can be configured in the LUIS portal. It is very important to specify the region where your LUIS app is published. You can check the available regions in the Regions and keys section.

Setup steps

1. Click the Login/Sign up button and sign in with your Microsoft Account (if you do not have one yet, you’ll need to create it first).
2. From the top panel, select My apps and then click the Create new app button.

3. Type the name SupportAssistant in our case select English as culture and then click Done.

4. Click the Create new intent button.

This is the place where intents can be defined, so the chatbot can understand what the user is saying in natural language.

5. Type RepairComputer as Intent name and click the Done button.

6. Here we need to add some sample utterances which the user might say. I prepared five sample utterances below:

  • Where can I report broken computer?
  • Who I can contact about broken computer?
  • What to do if my computer is broken?
  • What are the steps when my computer is not working properly?
  • My computer is down. Where I can report it?


7. Now entities used in the intent should be added to help LUIS choose the specific action to take to answer a user’s request. Entities are optional, but they are helpful. I chose three sample entities listed below:

  • computer
  • report
  • broken

To add an entity, move the mouse cursor over the word in one of our five utterances, for instance move it over the word computer. A dialog box should appear. Click Create new entity.

Type computer as the name of entity, select Simple as entity type and click the Done button.

Types of entities

At this point it may be helfpul to describe the entity types.

Simple

A simple entity is a generic entity that describes a single concept like computer or order.

Hierarchical

A hierarchical entity is a special type of a simple entity; defining a category and its members in the form of a parent-child relationship. For instance, there can be a parent Location entity with FromLocation and ToLocation child entities.

Composite

A composite entity is made up of other entities, such as prebuilt entities, list entities, and simple. The separate entities form a whole entity. PlaneTicketOrder is an example of such an entity, because it can have Number and ToLocation child entities.

List

List entities represent a fixed, closed set (white list) of related words in your system. City list is a good example because it allows variations of city names, including city of airport (Sea-tac), airport code (SEA), postal zip code (98101), and phone area code (206).

Regex

A regular expression (regex) entity ignores case and ignores cultural variants. For instance regex entity kb[0-9]{6,} matches kb123456.

You can add report and broken entities in the same way as the computer one.

8. Click the Train button at the top. It should display a green bar with successful training.

9. Click the Test button to run some tests on your prepared LUIS application.

10. Type an example utterance, sych as “My computer is down. What can I do with it?” and click enter.

11. To view the result, click the Inspect label.

Please note that based on this provided utterance, LUIS returned a top scoring intent called RepairComputer. Even though the utterance was not exactly the same as the sample utterances provided earlier, LUIS was able to identify it.

Publish the LUIS application

Once your Language Understanding Intelligence Service application is cofigured, you should publish it, so that your bot can connect to it.

1. From the top panel, select PUBLISH.

2. Click the Publish to production slot button.


Intelligent bot connected to LUIS

Once you’ve published your LUIS application, it is time to set up the bot and connect it to LUIS. The below diagram presents the language understanding bot solution architecture.

We will use the Microsoft Azure Bot Service to set up the chatbot and to connect it to the LUIS application. An active Microsoft Azure subscription is required.

Chatbot setup

1. In Microsoft Azure portal choose Create a resource.

2. Type Bot in the search window, then select Web App Bot and click the Create button.

3. Next, a blade with configuration should appear.

Chatbot configuration

There are a few details which you will need to provide in order to configure your chatbot within Azure Bot Service:

  • Bot name – let’s call it IntelligentSupportBot.
  • Subscription – Microsoft Azure subscription which will host your chatbot.
  • Resource group – there is an option to indicate whether to create your bot in a dedicated resource group or an existing one.
  • Location – defining where to place the resource group.
  • Pricing tier – in our case we’ll select Free.
  • App name – name of the web application, it can be the same as bot’s name.
  • Bot template – as I mentioned at the beginning, there are five bot templates – here we should select the Language understanding bot template.
  • App service plan/Location – it is possible to adjust scalability of the web applications hosted on Azure which is connected to pricing.
  • Azure storage – your bot can collect some data. To enable this functionality, you should create persistent storage.
  • Application Insights – tools to monitor your bot’s performance. In this case we can disable them.
  • Microsoft App ID and password – you should register your chatbot application as a Microsoft application with a unique ID and password. These are generated automatically when Auto create App ID and password is selected.
  • Terms of use notice – you will need to accept the terms that Microsoft will use data sent to LUIS to improve the service.

Connecting chatbot to LUIS

Once your configuration is ready, click the Create button. After a few seconds, language understanding bot service is enabled.

Click IntelligentSupportBot Web App Bot to open the blade with details.

To correctly integrate LUIS bot with Azure Bot Service, you should provide three values in Application Settings:

  • LuisAPIKey
  • LuisAppId
  • LuisAPIHostName

You can find these values in LUIS portal in the PUBLISH tab. Copy them to a safe place.

Now in Azure portal, open the Application Settings tab and paste the values as shown below, then click Save.

Test conversation

Once you’ve configured everything, you can test your chatbot. It is possible to do it via a Web Chat window.

I typed a question related to a broken computer and sent it to the bot. Then LUIS analyzed my question and assigned a suitable intent to it, which in this case is RepairComputer that I declared earlier in the LUIS portal.

There can of course be more complex use cases for specific requirements. In this particular case, the bot could ask the user about more details related to the broken computer to provide some advice.

Summary

Earlier I described Microsoft Azure Bot Service including chatbot templates and Question and Answers (QnA) bot configuration to show how it can improve communication and interact naturally with users. In this article, I presented how to connect the bot to Language Understanding Intelligent Service (LUIS) which uses natural language models to understand user intent in communication. Language understanding chatbot can be available for users through different channels too, such as Skype, Slack or Facebook Messenger.

This type of bot can be really useful in a variety of scenarios, not just IT support. You can use it to help make various arrangements (such as booking a flight) orto  generally improve customer service in situations where your users may not be familiar with all available options and need something to guide them.

Contact us so we can help implement your idea on how to use chatbots.

KEY TAKEAWAYS:

  1. A language understanding bot uses natural language models to understand user intent in communication
  2. Microsoft Azure Bot Service provides all the required components to set up such a bot
  3. You can use different communication channels for your bot, such as website, Skype or Facebook Messenger

Sign up for Predica Newsletter

A weekly, ad-free newsletter that helps cutomer stay in the know. Take a look.

SHARE

Want more updates like this? Join thousands of specialists who already follow our newsletter.

Stay up to date with the latest cloud insights from our CTO