PVA Series – entity extraction and more

One of the very powerful features of Power Virtual Agent is the functionality called “Entities”. It’s main purpose is to let bot ask question to user, then let user answer to the question in natural language, using full sentence and finally to extract from that response key points, that will let the bot to move on in the conversation.

Recently Jeff Zhang, Principal Product Manager from Microsoft, wrote this short blog post describing the abilities of built-in entities extraction in PVA:

I will help you to understand how to go far beyond that 🙂

Find out more – watch screencast


You can find this functionality easily – it is present in the main navigation. Once you open the page you will notice a long list of pre-defined entities, allowing you to eg. extract age from a sentence. For example – bot asks user: “what is your age?”. Now user is not required to answer using only numbers, right? Let’s assume user answers: “I am forty years old.” In a regular conversation flow, bot would get lost – wouldn’t know what is answer to its question (example no. 1):

But in case designer would choose “Age” entity to identify user’s response, then the smart entity extractor would decompose the sentence as below:

User’s responseEntitySaved value
I am forty years old.forty years40

This is extremely useful! And there are a lot of those pre-defined entities.

Custom entities

There is also a possibility for designers to create their own custom entities. To do that, simply click the link above title:

This way designer is able to create a set of words and their synonyms. If they are then used in conversation, they will be displayed as buttons (3), however user will also be able to answer with full sentence (1). But – if the sentence is too complex, if bot wouldn’t be able to match it to neither an entity or its synonyms, it would not be able to actually resolve it to anything and will get stuck (2):

Custom entities extraction

Right, but what if you’d like to simply ask user a question and get entity out from it (but not using one of the pre-defined sets) to move on? LUIS (Language Understanding Intelligent Service) from Microsoft is here to help you! 🙂

Using LUIS you are actually able to create your own entities extraction. Let me show you this step by step:

1) Set up LUIS

Go to and log in.

Important! To register for LUIS you must either use tenant admin account or have admin’s approval to use it.

Next, create Language Understanding service to work with LUIS. You need to do it obviously in It has to be configured (1) for both: runtime and authoring. Feel free to use F0 (free) pricing tier (2, 3) if you provision service just for testing:

Now go back to LUIS portal and create new app, by selecting subscription you used to provision the resource (1), then the resource itself (2), next click “create new app” (3) button and finally fill in the form (4).

You’re ready to go!

2) Setting up intents & entities

Next create intents. Intent is a set of examples used to qualify users’ input to it. In my case I have just one intent – User Issues that keeps examples of information users’ may write to bot once it asks them to describe the issue (however I could have two: one for each of the expected types of issues and then train LUIS to match user’s input with one of them).

Now go to Entities. These are basically the keyword that LUIS will be able to extract from the given intent based on how good you prepared it. So first create an entity. There are multiple possible types. In my case I chose “list” because I want to extract certain keywords from users’ input and based on them determine whether this is Software or Hardware issue:

Once you’re done with setting up the entities go back to your intents and check, if words used in your utterances matching entities are marked (1, 2). If not, simply highlight them and select a proper entity yourself (3):

Done! Now Hit the button “Train” in the top-right corner and after that: “Publish” (choosing Staging or Production publishing slot).

Now go to “Manage” – this information is required to set up communication between Power Automate and LUIS.

So why do you need to set up intents and entities? Basically for the scenario I am describing I would be totally fine with only two intents and a well trained service. However usage of Entities and their matching to keyword in intents increases recognition of the sentence and its assignment to a correct intent.

But why entities? Basically if I would like to go one step further, bot could be asking user to describe the issue following a specific template, eg. asking about the system, computer details, application name, device type etc… Then using entity extraction bot would precisely know, all the details of the issue even though it would be written using full sentence and natural language. That’s the power! 🙂

Eg. for the following sentence: “I have a problem with Excel datasheet. App doesn’t want to save the file informing me about missing permissions to a SharePoint library.”

Bot would receive the following data:
Issue type: Software
Application: Excel
Action: zapis pliku
Issue: uprawnienia
Location: SharePoint library

That it could use in further communication with a user or to create a helpdesk ticket and setting its metadata correctly.

3) Power Automate – flow

Create new flow. As a trigger use new, still in preview action, called “When Power Virtual Agents call a flow”:

Define input variable – this is going to be the input from the user – description of their issue.

Next send request to LUIS using HTTP action. You can do it either using GET or POST. If the content you want to send is more complex I suggest using POST and putting content in request’s body (source):

Good idea now is to make a test call using Postman for example, to get the response body JSON, to use it then for action “Parse JSON” configuration. This is now an example of that same sentence that my custom entity built in PVA wasn’t able to resolve. Using LUIS it is less than easy:

In my case, based on the number of actual matches to one or the other entity, flow is returning information to PVA whether user’s description is related to Software or Hardware topic.

So in my working scenario – bot asks user about the issue (1) – no need to first ask about the issue and then for it’s kind – this way it’s far more comfortable (and intelligent ;)) for the user. User answers using full sentence that is saved as variable (2). Then it is passed as the input parameter of the flow (3) that is calling LUIS and then calculating if the issue is related to Software (4) or Hardware.

Brief summary

I am personally under a huge impression of how easy it is today to create a really working conversational bot, that companies are able to use both for their internal and external purposes.

However main goal for the designers should be to create conversations to let users participate in them in as much natural way as possible. And that means both about the way they access them (Teams bot, Facebook bot, online chat) and how they conduct conversations. The less bot is asking step-by-step questions, but being able to understand natural language, the less frustration it will create on the participant side.

I really hope you will find this information useful. Please leave me a comment if you have any questions.

Tomasz Poszytek

Hi, I am Tomasz. I am expert in the field of process automation and business solutions' building using Power Platform. I am Microsoft MVP and Nintex vTE.

No Comments

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.