Actions and parameters

This page describes the actions and parameters settings for intents and how they are used when intents are matched at runtime.

When building an agent with the console (common), you can access these settings from the intent data. When building an agent with the API (uncommon), see the Intents reference.

Screenshot of action and parameters fields

Actions

The action field is a simple convenience field that assists in executing logic in your service.

When building an agent, you can set this field to any text you find useful.

When an intent is matched at runtime, Dialogflow provides the action value to your fulfillment webhook request or the API interaction response. It can be used to trigger specific logic in your service.

Parameters

When an intent is matched at runtime, Dialogflow provides the extracted values from the end-user utterance as parameters. Unlike raw end-user input, parameters are structured data that can easily be used to perform some logic or generate responses.

When building an agent, you control how data is extracted by annotating text in your training phrases and configuring the associated parameters.

The following list shows the fields of a parameter configuration. Examples are shown for the training phrase "book a room on Tuesday", where "Tuesday" is annotated.

  • Required: Check this box if the parameter is required for the intent to be complete. See the Slot filling with required parameters section below.
  • Parameter Name: A name that identifies the parameter. Example: date.
  • Entity: The entity type associated with the parameter. Example: @sys.date.
  • Value: The parameter value is an identifier used to reference extracted values set at runtime. See the Using parameter values in responses section below. Example: $date.
  • Is List: Check this box if the extracted values should be returned as a list. See the List parameters section below.
  • Prompts: Questions that the agent will ask the end-user if this parameter was not supplied. This field is only used if the Required field is checked. See the Slot filling with required parameters section below.
  • Default value: This is the default value for the parameter when the end-user does not supply one. To change the default value with the console, you must hover over the parameter row and click the menu on the right.

When building an agent with the console, parameters are automatically created for you when you add training phrases that contain text that can be matched to an existing entity. You can edit these automatically created parameters as needed.

When building an agent with the API, you must annotate training phrases and configure parameters manually. See the TrainingPhrase and Parameter types in the Intents reference. The Part.alias field associates training phrase annotations with particular parameters.

When an intent is matched at runtime, Dialogflow provides parameter data to your fulfillment webhook request or the API interaction response. These are provided as a mapping from parameter names to the extracted values determined by the associated entity types.

When building an agent, your responses can include extracted values. See Using parameter values in responses below.

List parameters

When building an agent with the console, checking the Is List option configures the parameter as a list. Lists can contain multiple elements. For example, a produce-ordering agent may expect the following utterances from an end-user:

  • "I want apples"
  • "I want apples and oranges"
  • "I want apples, oranges, and bananas"

Using parameter values in responses

The parameter value field is an identifier that references extracted values from an utterance at runtime. It is similar to a variable name.

When building an agent, the parameter value can be used to reference extracted values in responses. This is helpful for recapping information provided by the end-user. For example, your intent response could look like: "Okay, I booked a room for you on $date".

Reference original extracted values

When text is matched to a particular entity, it is often converted to text that is more convenient for processing. For example, the word "apples" in an end-user utterance may be extracted as "apple" for a fruit entity.

To reference the extracted value exactly as it was provided by the end-user, append .original to the parameter value. For example, you could reference the original extracted value of the date parameter as $date.original.

Reference extracted values from composite entities

Composite entities are entities that reference other sub-entities.

To reference the extracted value of a parameter's sub-entity, append .<sub-entity name> to the parameter value. For example, if the parameter value is "$move" and the sub-entity name is "direction", you can reference the extracted value as $move.direction.

Reference extracted values from contexts

Contexts can serve as temporary storage for extracted values from parameters. To reference an extracted value from an active context, provide the context name and then the parameter name like the following: #context_name.parameter_name

Reference an event parameter

To reference an event parameter, use the following format: #event_name.parameter_name.

Slot filling with required parameters

When building an agent, you can mark parameters as required. An intent is not complete until the end-user has supplied data for each of these required parameters.

Screenshot of required parameters fields

When an intent is matched at runtime, the Dialogflow agent continues collecting information from the end-user until the end-user has provided data for each of the required parameters. This process is called slot filling.

Dialogflow does not send a fulfillment webhook request until it has collected all required data from the end-user, unless webhook for slot filling is enabled.

Dialogflow does not send an API interaction response until it has collected all required data from the end-user.

When building an agent, you provide prompts that the agent will use to get parameter data from the end-user. You can also provide prompt variations, so the agent doesn't always ask the same question.

Screenshot of parameter prompts

For example, consider that your clothing store agent has an intent with required parameters for:

  • clothing type
  • quantity
  • size
  • color

Completing an intent may look like the following:

User: I'd like to buy a t-shirt.
Agent: How many do you want?
User: 3
Agent: What color would you like?
User: Black
Agent: What size?
User: Medium
Agent: Got it, that was three black t-shirts in medium

If the end-user supplies data for more than one parameter in a single utterance, Dialogflow collects the data provided and continues asking for the missing data. For example, the end-user may say "I'd like to buy three black t-shirts". Dialogflow would ask the user for the size.

Ordering parameters

When building an agent, you can order the parameters, which determines the order in which the agent will prompt the end-user for missing data.

When building an agent from the console, hovering over a parameter will reveal a reorder icon on the right. You can drag this icon to change the position of the parameter in the list.

Reference extracted values in prompts

When building an agent, you can reference extracted values in prompts, but only if the extracted values are from required parameters before the prompt. For example, if the "color" parameter is before the "size" parameter, you can use the following prompt for the "size" parameter: How many $color t-shirts would you like to buy?

Cancel slot filling

When the end-user says an exit phrase like "Cancel", "Stop it", "That's enough", etc., the agent replies with "Okay, canceled" and clears slot filling contexts.

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Dialogflow Documentation
Trenger du hjelp? Gå til brukerstøttesiden vår.