Intents

Stay organized with collections Save and categorize content based on your preferences.

An intent categorizes an end-user's intention for one conversation turn. Compared to ES intents, CX intents have been simplified to make them a more reusable resource.

An intent contains the following data:

Term Definition
Training phrases Training phrases are example phrases for what end-users might type or say, known as end-user input. When end-user input resembles one of these phrases, Dialogflow matches the intent. You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other, similar phrases.
Parameters You define your training phrases to use parameters to extract values from specific parts of the end-user input.

Intent matching

When an end-user writes or says something, referred to as end-user input, Dialogflow compares the input to intent training phrases to find the best match. This process is called intent matching. Intent matching can only occur for intents associated with an intent route (a state handler with an intent requirement) in scope.

When searching for a matching intent, Dialogflow scores potential matches with an intent detection confidence, also known as the confidence score. These values range from 0.0 (completely uncertain) to 1.0 (completely certain). Once intents are scored, there are two possible outcomes:

  • If the highest scoring intent has a confidence score greater than or equal to the classification threshold setting, it is returned as a match.
  • If no intents meet the threshold, then a no-match event will be invoked.

Training phrases

Training phrases are example phrases for what end-users might type or say, referred to as end-user input. For each intent, you create many training phrases. When an end-user input resembles one of these phrases, Dialogflow matches the intent.

For example, the training phrase "I want pizza" trains your agent to recognize end-user input that is similar to that phrase, like "Get a pizza" or "Order pizza".

You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other, similar phrases. You should create at least 10-20 (depending on complexity of intent) training phrases, so your agent can recognize a variety of end-user inputs. For example, if you want your intent to recognize an end-user's input about their favorite color, you could define the following training phrases:

  • "I like red"
  • "My favorite color is yellow"
  • "black"
  • "Blue is my favorite"
  • ...

Annotate training phrases

You control how end-user data is extracted by annotating parts of your training phrases and configuring the associated parameters.

For example, consider a training phrase like "What is the forecast tomorrow for Tokyo?" You should annotate "tomorrow" with a date parameter and "Tokyo" with a location parameter. When you annotate parts of a training phrase, Dialogflow recognizes that these parts are just examples of actual values that will be provided by end-users at runtime. For an end-user input like "What is the forecast on Friday for Sydney?", Dialogflow would extract the date parameter from "Friday" and the location parameter from "Sydney".

You must annotate all training phrase parts that are meant to be extracted as parameters. Otherwise, Dialogflow will not extract the values.

When building an agent with the console, most annotations are automatically created for you when you add training phrases that contain parts that can be matched to an existing entity type. These parts are highlighted in the console. You can edit these annotations and parameters as needed.

To manually annotate a training phrase with the console:

  1. Select the part of the training phrase that you want to annotate.
  2. Select the desired entity type from the list.
  3. A parameter is created for you in the parameter table below.

When building an agent with the API, you must annotate training phrase parts manually. See the TrainingPhrase type used by the Intent type.

Select a protocol and version for the Intent reference:

Protocol V3 V3beta1
REST Intent resource Intent resource
RPC Intent interface Intent interface
C++ IntentsClient Not available
C# IntentsClient Not available
Go IntentsClient Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available

Implicit entities created by training phrases

Most custom entities are defined explicitly by creating entity types and adding entity entries. However, custom entities may also contain implicit values. This happens when you annotate text of a training phrase, where the annotated text is not a value defined by the selected entity type. The annotated text becomes an entity reference value for the implicitly added entity entry. If the entity type is a map entity, the text also becomes a synonym for the entity entry.

Default welcome intent

When you create an agent, a default welcome intent is created for you. For some languages, the intent has simple training phrases like "Hi" or "Hello" that are meant to match initial end-user input. You can edit this intent as desired.

When using the API, you can reference this intent with the following intent ID:

00000000-0000-0000-0000-000000000000

If your agent initiates the conversation, you can trigger this intent using the API. Use the value projects/<PROJECT_ID>/locations/<LOCATION_ID>/agents/<AGENT_ID>/intents/00000000-0000-0000-0000-000000000000 in the QueryInput.intent.intent field when calling the detectIntent or streamingDetectIntent method.

Default negative intent

When you create an agent, a default negative intent is created for you. You can add training phrases to this intent that act as negative examples. There may be cases where end-user input has a slight resemblance to training phrases in normal intents, but you do not want these inputs to match any normal intents.

For example, a room booking agent may have a training phrase like "I'd like to book a room". If the end-user wants to purchase a book about rooms, they may say "I'd like to buy a book about rooms." To ensure that the end-user input does not match your intent, you can add that phrase as a negative example.

In addition, you should add possible phrases that are out of scope for the agent, so they will not match any intent. However, avoid adding a very large quantity of these phrases. For example, if you define 10,000 default negative intent phrases, this negatively impacts normal intent matching.

You should regularly review these phrases, as some of these phrases may have been originally out of scope for the agent, but were subsequently added to intents.

The default negative intent has impact across all intent matching. Phrases you add to it could benefit matching for one intent but harm matching for another. For example, you might add "international calling" to the default negative intent to avoid matching an international travel intent. However, this will also prevent that phrase from matching an international calling intent.

When using the API, you can reference this intent with the following intent ID:

00000000-0000-0000-0000-000000000001

Cancel intents

During a conversation, the end-user may want to cancel the current conversation topic. For example, the currently active page may be asking for a date for a new appointment, but the end-user has decided against creating a new appointment. The end-user may say something like "cancel" or "I do not want a new appointment". To handle this situation, you can create one or more cancel intents for your agent. You can name these cancel intents anything you like, but it is customary to include "cancel" in the name. You should associate these cancel intents with intent routes that are in scope at relevant points in the conversation. These intent routes should transition to an appropriate page to handle the cancellation.

The training phrases for cancel intents should handle both generic and topic-specific attempts to cancel. For example:

  • Cancel
  • Stop
  • I changed my mind
  • Nevermind
  • Take me back
  • Go back
  • I do not want a new appointment
  • Cancel new appointment
  • Delete new appointment

Create an intent

To create an intent:

Console

  1. Open the Dialogflow CX Console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Intents.
  6. Click +Create.
  7. Enter intent data.
  8. Click Save.

API

See the create method for the Intent type.

Select a protocol and version for the Intent reference:

Protocol V3 V3beta1
REST Intent resource Intent resource
RPC Intent interface Intent interface
C++ IntentsClient Not available
C# IntentsClient Not available
Go IntentsClient Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available

Delete an intent

To delete an intent:

Console

  1. Open the Dialogflow CX Console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Intents.
  6. Hover your mouse over the intent you want to delete.
  7. Click the delete button.

API

See the delete method for the Intent type.

Select a protocol and version for the Intent reference:

Protocol V3 V3beta1
REST Intent resource Intent resource
RPC Intent interface Intent interface
C++ IntentsClient Not available
C# IntentsClient Not available
Go IntentsClient Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available

Access intent data

To access intent data:

Console

  1. Open the Dialogflow CX Console.
  2. Choose your Google Cloud project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Intents.
  6. Click the intent you want to access.
  7. View or update intent data.
  8. Click Save to save any changes.

API

See the get and patch/update methods for the Intent type.

Select a protocol and version for the Intent reference:

Protocol V3 V3beta1
REST Intent resource Intent resource
RPC Intent interface Intent interface
C++ IntentsClient Not available
C# IntentsClient Not available
Go IntentsClient Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available

When designing agents, it is sometimes useful to think of intents as either head intents or supplemental intents. These terms are only conceptual, and Dialogflow does not natively distinguish them.

A head intent identifies the end-user's primary purpose for interacting with an agent. A supplemental intent identifies an end-user's subsequent questions that are related to the head intent. These subsequent questions may provide additional context for the end-user's needs, or they may be follow-up questions that help the end-user clarify or better understand something.

A head intent is usually one of the first intents matched in a conversation, and further end-user questions match supplemental intents. For example:

Dialogue Explanation
End-user: Activate new phone
Agent: Sure I can help you with that. What are the last 4 digits of the phone number you want to activate?
Head intent is matched
End-user: 1234
Agent: Are you ready to activate your phone now?
A parameter is set
End-user: Will all of my messages carry over to my new phone?
Agent: ...
Supplemental intent is matched