Teneo Developers

Your First Flow

Now that you have created a solution for your bot, it's time to add your first dialog. In Teneo, all dialogs are designed as flows. Flows contain the logic needed to resolve a specific question of the user. They can be simple (e.g. a flow that answers the question "What kind of coffee do you have?") or complex (e.g. a flow that helps the user order a coffee), but they always represent some kind of pre-defined conversational pattern.

Throughout these pages, we will create a bot for Longberry Baristas, a very hip (yet fictitious) coffee bar. We will start with a simple flow to handle the following conversation:

User: What kind of coffee do you have?
Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.

To achieve this we will do the following:

  • Create a folder in which we can store our flow.
  • Add a new flow.
  • Provide example inputs to recognize the user's intent.
  • Generate a Match based on the provided example inputs.
  • Add an answer text.
  • Save and test our flow.

The result will look like this:

final flow layout

Before you continue, make sure you are logged in to Teneo and have opened the solution you created earlier.

Create a 'Flows' folder

Flows are stored in folders. In the solution, you see several folders with flows that came out of the box. These flows make sure your bot will understand and respond to greetings, meta-requests (e.g. 'Can you repeat that?'), feedback (e.g. 'You are great') and conversational small talk (e.g. 'How are you?'). Since you are the owner of this solution, you can change the answers in these flows if you wish.

We will store our flows in a separate folder, so let's create that first.

  1. In the Solution dashboard in your new solution, click on the Solution Structure tile.
  2. Click the Plus(+) icon to create a new document. Once clicked, you will have the option to create a folder.
  3. Click on the 'Folder' icon. Give it the name Flows and click on 'Create'.

You can add as many folders and sub-folders as you like and you can structure them any way you like. This is particularly handy for bots that handle multiple domains.

Create your first flow

Now that we have a folder in which we can store our work, we can create our first flow:

  1. Navigate to the Flows folder.
  2. Click the Plus(+) icon followed by the 'Flow' button. This will create a new flow.
  3. Enter the name of the flow in the Name field, e.g. User asks about coffees we offer.
  4. Finally, click on 'Create' to create your new flow.

As you can see, flows are represented graphically in Teneo. Simple flows just contain a trigger that recognizes the user's intent (the blue box at the top) and an output that contains the bot's answer (the purple box at the bottom). More complex flows contain more elements like multiple triggers, scripts, different outputs, etc. We're going to start with a simple flow, so you will only need to populate the trigger and the output that you see in the flow graph.

Populate the trigger

Intents are used to recognize inputs from the user that express a similar intent. In this intent, we want to capture and understand the user's intent around which coffee Longberry Baristas serve. It is important to recognize that there can be several ways of expressing the same intent. For example, 'What coffee do you sell?' or 'Which coffees do you serve?'. To make the trigger match on user input, we need to add a match requirement. This requirement is essentially a criterion that needs to be met for an input to be matched.

  1. Locate the intent at the top of the flow.
  2. Give the intent a name like Tell me about your coffee.
  3. Click on the 'Edit' button, located at the right corner of the intent. This will allow you to edit the User Intents field. Add the intent What kind of coffee do you have?.
  4. Make sure you click on 'Close' to leave the edit window.

You might have noticed that the Trigger Intent has a yellow 'TODO' label under it; this means that the trigger does not contain a defined Match yet. Hovering over the 'TODO' label will give you more info on what's missing. We will define a Match below.

Now, you can repeat the step above to add more examples.

  1. Paste the following examples into the User Intent fields.
  • Do you have brewed coffee
  • Do you serve macchiato
  • Do you have cappuccino
  • Tell me about the coffees you have
  • Tell me about your coffee
  • What coffee do you serve?
  • What kinds of coffees do you serve?
  • What kinds of drinks do you sell
  • Which coffees are offered by Longberry Baristas?
  • Which drinks do you have?
  • Which sorts of coffees do you have
  1. Close the edit view.
  2. Finally it is time to add a Match to the intent. This can by done by clicking on the Plus(+) icon that has a yellow 'TODO' label beside it.
  3. Navigate to 'Match' and click on the 'Generate' button to automatically generate a Match based on the example specification.

Add multiple examples

When you generate a new Class Match, the class gets generated based on the training data that you assigned in the Intent examples. Once the class is generated, it gets added to the overall machine learning model of your solution. However, if you want to expand your Class with additional training data, you have to do so in the Class Manager. You will learn more about the class manager on a later page.

The Intent examples are also used for Auto-tests for when you want to automatically test your bot.

Add an answer text

Next, we will need to set the bot's answer in the flow. There are many options to define the bot's response. For now, we will focus on the answer text only.

  1. Navigate to the Output node and give it a name like, We offer a variety of handcrafted coffee drinks....
  2. Click on 'Edit' to expand the edit view. Here you can add an answer you want the bot to give when the flow is triggered. Add the following answer to the output, We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more. and close the edit view.

Save your flow

Now that we have added everything needed to our first flow, it's time to save it:

  1. Hit 'Save' in the top right.
  2. In the popup that appears you can leave a short description that will appear in the flow's version history, then click OK.

Adding a description will help you remember the changes you did and will show up in the Flows version history.

Done! Congratulations! You have created your first flow.

Test your flow

Now that you have created your first flow, it's time to test your work inside Studio Web.

  1. Click on the Tryout button, located at the bottom right corner. This will open the Tryout window.
  2. In this case, you can test your flow by trying out the following examples.
  • What kind of coffee do you have?
  • What drinks do you serve?

As you can see, both inputs will trigger your flow. Teneo not only recognizes the exact learning examples you entered but also different variations that express a similar intent.

Summary

You have just created your first flow, so you have already seen a few important concepts in Teneo:

  • Flows, which contain the logic to resolve a specific question of the user.
  • Folders, where you can store your flows and language objects.
  • Triggers, to recognize the user input or intent.
  • Match, to set a criterion that the user input must match.
  • Outputs, to provide the bot's response.
  • Tryout, which you use to test your flows.

Test yourself

Try adding another flow where the user can ask which coffee sizes are available at Longberry Baristas. The bot should return the three available sizes: small, medium, and large.