A condition is a test that can be evaluated to either true or false.
You can find conditions in different sections of your skill:
In this example, we test:
sentimentanalyzed in the sentence is negative
conversation memory, the value saved for
A condition is made of three parts: one operator and two operands.
In the condition
if #location.raw is Paris, the left operand is
is is the operator and
Paris is the right operand.
A few rules to distinguish the left operands categories:
@will get the associated intent (for example
#will get the associated entity (for example
#location), and will test the
rawfield unless you've specified one
_will get the associated field in the text analyze JSON or in the conversation state
Note: you can write the entire path if you need, like:
#location.lat (if you need the latitude) is the same as
nlp.entities.location.lat. Or if you need to access the
description of the first intent detected:
There's a finite list of operators you can use:
Note: the regex syntax follows the Ruby regex syntax.
Note bis: greater-than and lower-than only works with numerical values.
The right value can either be a free input or a finite list depending on what you've picked as the left operand.
For example, if you've picked
_sentiment, the right operand will be limited to what the Recast.AI API can return (in this case, from "very positive" to "very negative").
But if you've picked
_memory.my_value.my_key, any format is supported as it's not dependent of the Recast.AI API.
You can find more details on the entities' enrichment and the other keys with a finite list of possible values in the MAN.
You can create multiple layers of condition using
You can see in this example two groups: