Skip to main content

Safetynet

Sometimes your bot will not understand what the user says. It is thus important that your solution contains a fallback flow that deals with user inputs that are not understood. In Teneo, we call this flow a Safetynet flow.

Matches anything and is tested last

The Safetynet flow consists of a trigger with a star (*****) and %$*QUESTION as a language condition. The reason for this is that the Safetynet flow needs to be true for any input. To work as intended, Teneo must test all other triggers before falling back to the Safetynet trigger. The Safetynet trigger must thus be placed at the bottom of the trigger ordering.

safetynet-script

A flow like any other flow

Apart from having a very generous language condition, a Safetynet flow is like any other flow. It may be triggered when there is no other active flow in process, or in the middle of some other flow as in the following example:

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

User: ajkfhh (the coffee order flow is interrupted and the Safetynet is triggered) Bot: I'm sorry but I didn't get that. (Safetynet response is given)

Bot: Let's continue with your order. Which coffee would you like? (the coffee order flow is resumed)

The same Safetynet flow may thus cater to non-understood inputs in all sorts of different contexts!

Activate in Tryout

You can trigger the Safetynet flow in Tryout by following these steps:

  1. Click on the Tryout to start a conversation.
  2. Write something nonsensical, like: ajkfhh.

Build a Safetynet flow

The Safetynet fallback flow is crucial for every solution. This flow can be built using the following steps.

The Dialogue Resources come with a pre-built Safetynet flow. You can find it in the 'Safetynet' folder. For solutions in languages without available Dialogue Resources, it is useful to add your own Safetynet flow using the following instructions and localizing to the language in question.

Create a Safetynet order group

The Safetynet is always located at the bottom of the order groups. This is because the Safetynet is built to trigger on every single input, catching the inputs that are not covered inside the solution. In order for the Safetynet to not steal any of the inputs, it is important to create an order group specifically for the Safetynet and place it at the lowest level.

More on how to create your own custom order group can be found here: Create a Custom Order Group.

Create a Safetynet Flow

To begin with, create your flow by doing the following:

  1. Click on the 'Flow' icon in the top ribbon.
  2. Name the flow Safetynet.
  3. Click the arrow in the top left corner of the window to go to the main flow window.

Create a TLML Syntax Match

As mentioned above, the Safetynet flow uses one TLML Syntax Match. You can now go ahead and create that:

  1. Select the trigger and name it Safetynet.
  2. Scroll down to the 'Match' section and click on the 'Add' button. This will toggle a dropdown list of different Match requirements to select.
  3. Select 'TLML Syntax' and then paste in the following condition: / %$_QUESTION.
  4. Lastly, change the ordering by locating the Triggering section and selecting the Order Group we created in the steps above, Safetynet. This will change the flows trigger ordering.

Add answer texts to the output

As the Safetynet fallback flow is one of the most triggered flows, it is important to add a wide range of answer texts inside the output node.

Output nodes can contain multiple answer variations to make the conversation more dynamic.

Teneo will choose any of these answers randomly and return it to the user. User has also the option to 'Set order' for the outputs to show.

  1. Select the output node and paste in the following answers:
  • I'm sorry but I didn't get that.
  • I'm not sure I know what you mean?
  • Can you help me understand that?
  • Can you say that again using different words?
  • I didn't get that.
  • I'm afraid I have no answer for you.
  • I don't have a good answer to that.
  • Sorry, can you rephrase that for me?
  • I don't think I got that.
  1. Save the flow.

Create an area Safetynet flow

An area Safetynet captures ambiguous inputs, but instead of giving a standard answer it recognizes what topic the user mentioned and tries to redirect the conversation towards that goal.

For example, if a user mentions the word 'coffee' without any other context, the bot might respond like this:

User: coffees Bot: I understand you would like to talk about coffee. Can you be more specific? Did you want to order a coffee or see our selection of coffees?

User: your selection Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.

The following section defines a practical example of how to build an area Safetynet.

Handle ambiguous inputs

A good dialogue system is able to get the conversation back on track if the user makes an ambiguous request. On this page we'll look at the flow we built in Create a Custom Order Group and expand it to help users find the correct answer to their question. We'll do this using flow links, which allow us to send the user to a flow meant to answer the question. In the Partial understanding: Coffee flow we'll first present users with likely options of what the question might have been, and allow users to give a clarifying response.

Before our changes we would have a conversation like this:

User: coffees Bot: I'm not sure what you wanted to ask about coffee. Could you please help clarify?

User: your selection Bot: I'm sorry but I didn't get that.

After our modifications, it will look like this:

User: coffees Bot: I understand you would like to talk about coffee. Can you be more specific? Did you want to order a coffee or see our selection of coffees?

User: your selection Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.

User: espresso Bot: You're talking about coffee. Would you please tell me what you wanted exactly? Did you want to order a coffee or see our selection coffees?

User: order Bot: Ok, what coffee would you like?

To achieve this, we'll enhance the example Create a Custom Order Group by following these steps:

  • Add an additional output to ask if the user wants to order a coffee or see the selection.
  • Add links to flows User wants to order a coffee and User asks about coffees we offer
  • Make sure we send the user to the correct flow depending on the user's response (order or selection)

When we're finished, our flow will look like this:

final flow

Add a new output

Let's first expand the current prompt to offer the user several possibilities.

  1. Open the flow 'Partial understanding: Coffee' in edit mode.

  2. Select the Plus icon under 'Respond to single synonym: Coffee', followed by 'Continue with' transaction element' and 'output'.

  3. Select the new transition and make sure the Get input before continuing checkbox are unchecked and the User Intent is removed.

  4. Select the Output below, name it Ask user what was meant and add the following answer text: Did you want to order a coffee or see our selection of coffees?.

Now it's time to add a flow link if the user wants to order a coffee.

  1. Select the Plus icon below the output 'Ask user what was meant', hover over 'Continue with' and select Flow link.

  2. Select the transition and name it Order.

  3. Make sure 'Get input before continuing' is selected.

  4. Add the positive intent Order and generate a 'Match'.

  5. Navigate to the new flow node and name it User wants to order a coffee.

  6. Add the User wants to order a coffee flow via the Flow Link panel using the Browse button in the Target section.

Now that we've covered the order flow link. It's time to add one more if the user wants to see the coffee selection.

  1. Select the Plus icon below the 'Ask user what was meant', followed up with 'Split path' and Flow link.

  2. Name the new flow node User wants to see the selection.

  3. Add the User asks about coffees we offer flow via the Flow Link panel using the Browse button in the Target section.

  4. Navigate to the transition above name it Selection.

  5. Make sure 'Get input before continuing' is selected.

  6. Add the positive intent Selection and generate a Match.

  7. Hit the 'Save' button.

Test in Tryout

User: coffees Bot: I understand you would like to talk about coffee. Can you be more specific? Did you want to order a coffee or see our selection of coffees?

User: your selection Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.

User: espresso Bot: You're talking about coffee. Would you please tell me what you wanted exactly? Did you want to order a coffee or see our selection coffees?

User: order Bot: Ok, what coffee would you like?