Teneo Developers

Microsoft LUIS and Teneo in 10 minutes

Congratulations! You are about to discover what Teneo is all about and the core concepts behind it. The 'Microsoft LUIS and Teneo' section will get you started with the Teneo platform together with LUIS. They provide step-by-step instructions for building intelligent bots in Teneo.

Once you are done, we will show you more in the following sections:

My Teneo

You've just requested access and gotten your hands on your fresh Teneo Developers account. If you haven't logged in yet, please log in using your sign-up credentials.

Once logged in, you are greeted by the Team console. My Teneo is divided into three main areas.

  • On the Environment page, you can access your Teneo environment and see the status of your environment.
  • The Bots page allows you to quickly see which bots are in your environment.
  • Finally, in the Teams page, you can invite your colleagues to your team.

When your environment is ready, the status will change to 'Running', and you will be able to download Studio Desktop.

manage environment

Your first step into Teneo Studio

Now that you've opened Teneo Studio, it's time to get to work. Let us start with entering Studio:

  1. Fill in your username and password. The login credentials are the same as for the team console.
  2. Click 'Login'.

Once logged in you will be greeted by the main solution window. Here, you'll find the solutions you have recently worked on and the solutions you own.

  1. Click on the 'Solutions' link in the sidebar to get into the solutions view.

In this view, you can see all the solutions available to you in this environment. A solution can be thought of as a container where all the bot's knowledge is stored.

As you can see, there's already a solution called 'Longberry Baristas' available to you. Each team gets this pre-built solution which can act as a reference solution when you're building your own bot. Let us take a look inside:

  1. Select the solution.
  2. Click on 'Open' above the solutions field.

In this section, you can find meta-information about the solution, such as when it was built, when it was last updated, and when it was last published.

Connect your LUIS application to Teneo

Now it's time to build a bridge between your LUIS solution and Teneo. This will make your solution to bypass Teneo's native classifier together with it's classes inside Class Manager and instead use LUIS native intent classifier.
The first step is to add LuisPredict.groovy to your solutions file resources. This .groovy file contains the needed code to make this possible.

  1. While inside the Resources section, select 'File' located at the top.
  2. Use 'Add' on the upper right to add the .groovy file. Alternatively, you may drag and drop it.
  3. Change the Published Location to /script_lib.
  4. Hit 'Save'.

Prepare your LUIS application

It's time to visit the LUIS application to collect some details which later will be used to connect this LUIS application to your Teneo solution. But first, we'll need to import intents to our LUIS application. When you created your solution, you based it on the 'Longberry Baristas' template solution which comes with many prebuilt flows and intents. To make sure LUIS is aware of these intents, we'll need to import them into your LUIS application.

  1. Download Longberry-Baristas.lu and store it somewhere safe.
  2. Create a new LUIS application by pressing the dropdown menu beside the 'New app' button.
  3. Select 'Import as LU' and choose the LU file you downloaded.
  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.

Once the application is created and trained it's time to collect some details, so we can add them to your Teneo solution later. You can temporarily store them in a text file.

  1. Select 'MANAGE' located on the top right bar.
  2. Select 'Settings' from the sidebar to the left store the following value:
  • App id.
  1. Select 'Azure Resources' from the sidebar to the left.
  2. You should arrive to this page, and store the following values:
  • Primary Key
  • Endpoint URL.

LUIS^Teneo - Screenshot from Azure LUIS site

Prepare your Teneo solution

Now it's time to prepare our Teneo solutions by adding a Global Variable and a Global Script.

First, we'll add a global variable called luisPredict to the solution. This variable should contain the api keys of your LUIS application. Before we add the variable to the solution, let us prepare its value. Copy the following code and populate it with the values you collected from your LUIS application above:

groovy

1new LuisPredict('primaryKey','endpointURL','AppId')
2

The result should look something like this: new LuisPredict('12345678910abcd','https://www.luis.ai/applications/abcd-efghi-jklmn-opqres-tuvw-qq-112112/'', 'dcba019876543210')

Now, let's add the global variable:

  1. Select 'Globals' in the purple bar on the left-hand side, and then select 'Variables'.
  2. Click 'Add'. A panel for specifying the new variable appears on the right-hand side.
  3. Name the variable: luisPredict.
  4. Set its value to the string you created above.
  5. Hit 'Save'.

Now, let's update the global Pre-Matching script:

  1. Select the 'Scripts' tab at the top.
  2. Use the 'Add' button to creat a new 'Pre-Matching' script.
  3. Click on the 'Add' button in the top right and add the following groovy line into the editing window luisPredict.predict(_).
  4. Click on 'SCRIPT' to name the script Call luisPredict.
  5. Hit 'Save'.

Publish your bot on Teneo Web Chat

There are multiple ways of interacting with a chat bot, such as through an app, on a website, or in your car. In order to make your bot available anywhere, you will need to publish it.

Before publishing the bot, let's make sure it is working as intended by having a conversation with it in Tryout:

  1. To the right in the explorer window, you'll find Tryout.
  2. Chat away!
    Perhaps you could try a conversation like this:
  • Hi!
  • I would like to order an espresso
  • John
  • Goodbye

Now, let's publish the Longberry baristas solution so that we can have a chat with it through Teneo Web Chat.

  1. To enter the backstage view, click the ‘Solution’ button in the upper left corner.
  2. Select the 'Publish' button, this will take you to the publish page for your bot.
  3. Click the 'Manage' button and in the dropdown choose 'Publish' under 'Latest'.
  4. You might see a warning Publish to 'Default env' stopped with warnings appear.

publish-error-2

This is nothing to worry about, the warning is shown when you publish your solution for the first time or when you have made certain global changes. To proceed, just check the checkbox 'Perform full application deployment on try again' and click the 'Try again' button.

Congratulations, you have just made your first solution available online! The next step is to interact with it. There are two ways to interact with a newly published solution, you can either interact with it through a test page or a chat widget. We are going to show you how to try out your bot through the chat widget, Teneo Web Chat.

  1. Once published, click on the blue 'Open' icon. This will open the Teneo Web Chat in a new browser tab.

Teneo Web Chat is also available in the Bots section in your team console. You need to publish the bot from Teneo Studio before using it.

  1. Click on the blue icon in the bottom right corner to open up the Teneo Web Chat window.
  2. Have a conversation like the one you had previously in Tryout.

The chat widget that you just tested is known as Teneo Web Chat. This widget can be embedded in websites and supports rich media such as buttons, cards, quick replies, and much more!

If you want to try out your published solution via the test page, click ‘Open’ in the publication confirmation pop-up. If you have already closed it, you can click the URL shown in the ‘Publish’ window instead. This will open a test page where you can try out your bot.

Your first step into a flow

Currently, the 'User wants to order a coffee' flow grabs the coffee type when we mention it in the first input. Unfortunately, this is not currently the case with names. Our goal with the next few steps is to fix that.

Before:

User: I want to order one flat white, my name is John.
Bot: Ok, what name shall I note for the order?

User: I just told you, my name is John!
Bot: Thanks for your order, John. Your flat white will be ready for pickup in 5 minutes.

After:

User: I want to order one flat white, my name is John.
Bot: Thanks for your order, John. Your flat white will be ready for pickup in 5 minutes.

Now let us explore how these conversations are possible!

Start with going back to Teneo Studio and edit the 'User wants to order a coffee' flow, and the option to store the name in the first input while ordering coffee.

  1. Open the flow 'User wants to order a coffee'. This is located inside the 'Flows' folder.
  2. Click on 'Edit' in the top left corner in the flow window. This will bring you into the edit mode of the flow.
  3. Select the 'Order a coffee' trigger.
  4. In the panel on the right, scroll down to 'After Match' and add a new Entity.
  5. Paste in the following Entity: PERSON. This entity will help the bot recognize and capture when a name is mentioned by a user.
  6. Click on 'Add Mapping' below the entity name.
  7. Now use the drop-down menu below to determine the source 'sPerson' and the target 'userNameForOrder'. This transfers the value from the source and transfers it to the target.

Now it's time to specify when the output should be skipped:

  1. Select the 'Ask for name' node, this will open the output configuration panel to the right.
  2. In the middle of the output configuration panel, you will find the 'Skip Conditions' field. Click on 'Add' to create a skip condition.
  3. Paste userNameForOrder into the 'Skip Conditions' field. This will be evaluated to true if the variable is set and to false if the variable is empty.
  4. Now use the drop-down menu beside 'Skip to' to determine how the flow processing should go on. In this case, it should be 'Get user name'.
  5. Hit 'Save'.

Republish and test your flow

Now that we have updated the flow we need to republish to make the changes available online.

  1. Head back to the Solution window and click 'Solution' in the top left corner.
  2. Select the 'Publish' button, this will take you to the publish page for your bot.
  3. Click the 'Manage' button and in the drop-down choose 'Publish' under 'Latest'.
  4. Once published, click on the blue 'Open' icon. This will open the Teneo Web Chat in a new browser tab.
  5. Click on the blue circle in the bottom right corner to open up the Teneo Web Chat window.
  6. Let us test if the changes we've made work. Open up Teneo Web Chat and paste in the following line: I want to order one flat white, my name is John.

Congratulations! You have now experienced a small glimpse of what Microsoft LUIS and Teneo is capable of.