Teneo Developers

Share to

Combine match requirements

Sometimes our trigger may appear too generous. For example, consider the two different user inputs below, which both trigger the first flow created in our Longberry Baristas, User asks about coffees we offer, even though only the first one should:

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

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

What we need to do is to restrict the trigger from triggering too generously, so that the second input goes to another flow or to the Safetynet fallback flow instead:

User: Which teas do you serve?
Bot: I'm sorry but I didn't get that.

We will restrict the 'User asks about coffees we offer' flow from over-triggering by combining match requirements in addition to the class match in the trigger. This way, we can impose hand-picked restrictions on the Class Match. For example, we can restrict it to only trigger if certain words like 'coffee' or 'drink' are present in the input.

To accomplish this, we will need to do the following:

  • Add a TLML Syntax Match to the trigger
  • Create a condition
  • Add a confidence threshold

Once we're done, the final flow will look like this:

combine-web

Teneo 7.5 introduces a new Flow User Interface in Teneo Studio Web. Images and videos will be updated gradually. Please refer to the Release Notes for a preview of the new look-and-feel.

Add a TLML Syntax Match

We will start off by doing the following:

  1. Open the 'User asks about coffees we offer' flow that we created earlier in edit mode.
  2. Select the 'Add match requirement' below the trigger 'Tell me about your coffee'.
  3. Scroll down to 'TLML Syntax' and add it.
  4. Paste in the following condition (%COFFEE.NN.SYN/%DRINK.NN.LEX).

Add a confidence threshold

We will now add a confidence threshold to the trigger to ensure that it is only triggered when the machine learning algorithm is sufficiently confident.

  1. Select 'Add match requirement' below the TLML Syntax condition.
  2. Add a 'Global Scripted Context'. This will allow you to add Context to your trigger.
  3. Add the context 'Class Confidence Medium' from the drop-down menu.
  4. From the dropdown select '0.60'.
  5. Save your flow.

Try it out!

Now, go to Tryout and give it a try! You should now get a similar answer as below. As long as you do not get the 'We offer a variety of handcrafted coffee drinks...' answer when asking for tea, you have succeeded!

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

User: Which teas do you serve?
Bot: I'm sorry but I didn't get that.