How to use LUIS Entities

Another big advantage with LUIS^Teneo is the use of entities. Entities can capture and pass important information from the user input. LUIS provides many prebuilt entities covering common fields like person name, geography info, etc. A user can also create their own entities in LUIS. This section will show how to use LUIS entities in Teneo Studio.
Sometimes it's not enough to recognize which flow to trigger. Your bot may also need to extract some piece of information from the input to respond appropriately.

One example of a typical use case is summarizing the user input:

User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?

User: A cappuccino, please.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.

In the following, we will show you how to create a flow that enables users to have this kind of conversation with your bot. These are the steps involved:

  • Create a new LUIS intent.
  • Create the same intent in Teneo.
  • Create a new Teneo flow with a Class Match requirement.
  • Set up a flow variable.
  • Add another output node.
  • Configure a data action to extract information.
  • Use the information in the output.

End result of your first flow

Create a new LUIS intent

We will start off by creating a LUIS intent inside our application which will be used by our Teneo solution.

You will need to do the following:

  1. While inside your LUIS application, create a new intent by pressing 'create'.
  2. Give your intent the name: ORDER_A_COFFEE.
  3. Add the following examples:
    • A small filter coffee, please
    • Can I get a coffee?
    • Can I have a coffee, please?
    • Can I order a coffee
    • Can I order an espresso?
    • Can you get me a coffee
    • Could I get a large macchiato?
    • Could I have a flat white
    • Could I order a large americano
    • Give me a Frappuccino, please
    • I want a small cappuccino!
    • I want espresso
    • I want to order a coffee
    • I would like a coffee
    • I would like to order a coffee
    • I'd like a large espresso
    • I'd like to order an americano
    • May I have a filter coffee?
  4. Press the 'Train' button located at the top right corner. This will train the intent and score the examples.
  5. Once the training is done press 'Publish' at the top right corner. This so Teneo can retrieve it.

Create the same intent in Teneo

Now its time to create the same intent we did for LUIS in the previous step but inside Teneo.

  1. We'll start of by selecting the 'Class Manager' icon in the 'Solution' group in the Ribbon. This will open a new window for the 'Class Manager'.
  2. Select the 'Add Class' button located in the 'Classes' group in the Ribbon.
  3. Give your class the same name as your LUIS intent: ORDER_A_COFFEE.
  4. Next, right-click the empty area in the learning example area and paste the inputs (alternatively, you can add them one by one)..
    A small filter coffee, please
    Can I get a coffee?
    Can I have a coffee, please?
    Can I order a coffee
    Can I order an espresso?
    Can you get me a coffee
    Could I get a large macchiato?
    Could I have a flat white
    Could I order a large americano
    Give me a Frappuccino, please
    I want a small cappuccino!
    I want espresso
    I want to order a coffee
    I would like a coffee
    I would like to order a coffee
    I'd like a large espresso
    I'd like to order an americano
    May I have a filter coffee?
  5. Finally press the 'Save' button and close the 'Class Manager' page.

Create the basic flow and add a Class Match Requirement

Now it's time to create a flow in Teneo where we can use our previously created LUIS intent. To do that we'll need to do the following:

  1. Select the 'Flows' folder and create a new flow by pressing the 'Flow' button.
  2. Once the flow has been created a new window will open, enter the flow name User wants to order a coffee into the name field.
  3. Press the back button in the top left corner and select the trigger to open the trigger configuration panel.
  4. Give the trigger the name Order a coffee
  5. Scroll down to 'Match Requirements' and press add.
  6. Select 'Class' and paste in the Class name ORDER_A_COFFEE .

Populate the output node

In the output node, we want to prompt the user to indicate the desired coffee type in more detail:

  1. Select the output node.
  2. Name the node Ask for coffee type.
  3. Go to the 'Answer' panel on the right and paste the following: Ok, what coffee would you like?.

Extract information from the user input

So far so good. You now have a flow that triggers when users want to order a coffee and it answers with a question about the coffee type. To be able to pick up the coffee type from the user input, we now need to proceed with the following:

  • Setup a flow variable to store the coffee type.
  • Add an additional output node that will summarize the order including the coffee type.
  • Extract the coffee type on the transition between the two output nodes using a data action.

Create a flow variable

The flow variable we create here will later hold the coffee type that the user has mentioned:

  1. In the solution's main window, move to the 'FLOW' tab, and select 'Variables' in the purple navigation bar on the left-hand side.
  2. Add a variable and name it orderedCoffeeType.
  3. Put "" in the 'Evaluation Script' field. This initializes the variable with the empty string.

Add an additional output node

Now it's time to add an additional output node which will hold the summary of the user's order. Note that we add the newly created variable orderedCoffeeType to the output despite the fact that it has not yet received a value. This will happen in the next step below. First, we have to:

  1. Select the output node.
  2. Go to the top ribbon and add a new output node. It will be attached to the existing output node.
  3. Name this output node Summarize order.
  4. Select the 'Answer' field of the new output node and paste Ok, a ${orderedCoffeeType} will be ready for pickup in 5 minutes..

Configure the transition

The transition between the two output nodes should only be traversed if the user mentions a coffee type. To ensure that, we need to:

  1. Select the transition between the two output nodes.
  2. Name the transition User responds with coffee type.
  3. Go to 'Match Requirements' and click 'Add' and then 'Entity' from the drop-down menu.
  4. Enter LUIS_COFFEES_SERVED in the Entity field. This means that Teneo will only continue when the user mentions something which matches the entity.

Extract information from the entity

Finally, we will store the coffee type that the user has mentioned in the flow variable orderedCoffeeType, and we will do so using a data action:

  1. Select the User responds with coffee type transition
  2. In the panel on the right, go to 'Data Actions', click 'Add', and hover over 'Entity' from the drop-down menu. When on the little triangle, all available entities will appear. Select LUIS_COFFEES_SERVED.
  3. Now click into the 'Entity' field, which will make the 'Add Mapping' button clickable. Click the 'Add Mapping' button.
  4. The 'Source' field denotes the value of the NLU variable of the entity 'LUIS_COFFEES_SERVED' that we want to store. In our case coffeeType.
  5. The 'Target' field denotes the name of the variable where the extracted value is to be stored. In our case luisCoffeeType.
  6. Save the flow and you're done!

Test the scenarios

Now it's time to test the flow!

User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?

User: A cappuccino, please.
Bot: Ok, a cappuccino will be ready for pickup in 5 minutes.

Test yourself

Now if you have done the previous test yourself there should be a working entity for Coffee Sizes. Add that entity here and don't forget to try it on Try Out.

Where to go next?

Next page is about Skipping Conditions In case the user already has mentioned the coffee type they're interested in before the bot.

Was this page helpful?