Intents

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".

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# Not available Not available
Go Not available Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available

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

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.

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 GCP 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# Not available Not available
Go Not available 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 GCP 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# Not available Not available
Go Not available 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 GCP 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# Not available Not available
Go Not available Not available
Java IntentsClient IntentsClient
Node.js IntentsClient IntentsClient
PHP Not available Not available
Python IntentsClient IntentsClient
Ruby Not available Not available