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.
We'll continue with the 'What can I get for 20 dollar?' flow created in the last page to capture the amount of money a user mentioned and calculate how many cups of coffee can user get.
This is how such a conversation could go about:
User: What can I get for 20 dollars?
Bot: For 20 dollar you can get 10 cups of coffee.User: What can I get for 40 dollars?
Bot: For 40 dollar you can get 20 cups of coffee.
To achieve this we will do the following:
This is what your flow will look like:
We will start off by adding a prebuilt entity inside our LUIS application,
The entity page should look like this when you are done:
To be able to store the amount and currency mentioned by the user, we need to create two flow variables:
amount
by replacing the word 'Variable 1'.0
.money
with ""
as default value.Now that we have the trigger in place it is time to pick up the amount and currency that the user mentioned. We will do so by using a flow listener:
Name it Get amount of money
and paste %$LUIS_MONEY.ENTITY^{amount = lob.number ; money = _USED_WORDS}
in the condition field. This will store the part of the user input that matched the LUIS entity in the flow variable amount and money.
With nothing else in the flow marked, click the 'Script' icon in the ribbon. This will add an empty script node to your flow. Give it a name that explains what the script does, like Calculate amount
.
Currently, our script node is dangling and not connected to any of the other elements in the flow. However, we want our script to be executed immediately after the flow is triggered, and right before the output is shown to the user. To achieve this we need to follow these steps:
We have added the script node, but it is still empty. Now we'll need to add the script that calculates the number of cups it can afford. Select the script node in your flow, open the 'Script Action' tab on the right sight of the screen and paste the following code into the script node:
amount = amount / 2
The only thing that remains to be done now, is to configure the output node to summarize the flow.
For ${money} you can get ${amount} cups of coffee.
... cups of coffee!
.That's it. Now go to Try-out and give it a go! The answer should change depending on the amount provided.
User: What can I get for 20 dollars?
Bot: For 20 dollar you can get 10 cups of coffee.User: What can I get for 40 dollars?
Bot: For 40 dollar you can get 20 cups of coffee.
Now that we know how to use LUIS^Teneo its time to learn more about, Deploy your bot where you'll find documentation on our SDK's and example connectors for platforms like Microsoft Bot Framework, Slack, Facebook Messenger and Google Assistant.
Was this page helpful?