Within each intent, there is a table under the training phrases section entitled Action and parameters. Once you annotate your training phrases, the corresponding parameters are automatically added by the Dialogflow Console and appear in this table. This section also contains a text field named "action". The value of this field is passed to fulfillment and can be used to trigger specific logic.
The highlighted words in your training phrases represent entities that are extracted as parameters at runtime. For every part of a training phrase that you annotate with an entity, a corresponding parameter stores the extracted value from the utterance. This lets you convert free-form user input into structured data that can be used to do some logic or generate responses.
As an example, let's look at one of the example training phrases we defined earlier— "What is the weather like on Tuesday at 3 PM". The date and time entities (corresponding to the values Tuesday and 3 PM) are automatically annotated as
If the user said something like "weather on Thursday at noon", your agent would extract the parameters associated with date and time entities— "Thursday" and "noon". These parameters are passed to fulfillment if fulfillment is enabled for that intent. You can then use these parameters to look up the weather and repeat them back in your response, such as "The weather on Thursday at noon is 75 degrees and sunny".
The value of a parameter can be used in responses to refer to that parameter. The value is like a placeholder or the variable assigned to the parameter. For more information on using these in responses, see the extract parameter values section below.
Lists can contain an indefinite number of parameter values.
For example, a produce-ordering agent may expect the following utterances from a user:
- "I want apples"
- "I want apples and oranges"
- "I want apples, oranges, and bananas"
Checking the IS LIST option in the parameter table sets this entity as a list. This allows any number of possible parameters in a user utterance to be picked up as one entity.
Extract parameter values
When you define responses, you can reference extracted parameter values and include them in the response. This is helpful for recapping information provided by the user.
To extract the parameter value exactly as it is provided by the user, add
.original after the name.
For example, if a parameter value can be pluralized, you want to return the same version the user provided in their input. In the case of a produce-ordering agent, you would want to return "apples" instead of the singular "apple" Dialogflow would return by default. The reference to this parameter value would look like this:
Composite entities are single entities that reference two or more other entities. For an example of a composite entity, see Composite entities.
To extract a value that is part of a composite entity, add
.sub_entity_name after the composite entity parameter reference, which looks like the following:
To refer to a parameter value in an active context, provide the context name and then the parameter name, like this: