In Teneo you can add constraints to a trigger or transition by using context restrictions. The role of a contextual restriction is to make sure an input not only matches a trigger or a transition, but that additional information is evaluated before the flow is triggered or the transition is traversed. This contextual information varies depending on the current conversation.
There are two different types of context restrictions:
For example, the class trigger below contains a scripted context restriction that prevents it from triggering if the confidence score of the input is lower than 0.60 (which corresponds to 60%):
You add a restriction to a trigger or a transition in the tab where you provide the learning example inputs:
The Teneo Dialogue Resources (TDR) come with a number of predefined (scripted) contexts out of the box, you can find their definitions in the globals section of your solution:
For a practical example of how to use a predefined context, please read How to deal with Follow-ups.
Variable-based context restrictions evaluate if a global or a flow variable matches a particular value. They are applied to triggers and transitions. Only if the input of the user matches the trigger or transition and if the variable that is used in the context restriction matches the desired value, then the trigger or transition will be traversed.
In the image above the trigger 'Can I have one of those?' is context restricted by the global variable 'coffeTypeInFocus'. If an input matches the trigger, it can only fire if the variable 'coffeTypeInFocus' is not empty, and the context thus evaluates to true.
To learn how to use a variable-based context, head over to How to share information between flows.
The predefined contexts that come with the Teneo Dialogue Resources are essentially scripted contexts. However, you are not limited to using just those. You can add your own scripted contexts too. They are created and maintained in the same place (in the Globals section of your solution) where you find the predefined contexts.
A scripted context consists of a script and one or more expected states (outcomes). Once a trigger or transition with the applied scripted context is up for evaluation, the script is executed. If the outcome of the script matches the desired state of the context restriction, the trigger or transition will fire.
For a practical example of creating a custom scripted context, see How to define a scripted context.
Was this page helpful?