REST Resource: projects.locations.agents.intents

Resource: Intent

An intent represents a user's intent to interact with a conversational agent.

You can provide information for the Dialogflow API to use to match user input to an intent by adding training phrases (i.e., examples of user input) to your intent.

JSON representation
{
  "name": string,
  "displayName": string,
  "trainingPhrases": [
    {
      object (TrainingPhrase)
    }
  ],
  "parameters": [
    {
      object (Parameter)
    }
  ],
  "priority": integer,
  "isFallback": boolean
}
Fields
name

string

The unique identifier of the intent. Required for the Intents.UpdateIntent method. Intents.CreateIntent populates the name automatically. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.

displayName

string

Required. The human-readable name of the intent, unique within the agent.

trainingPhrases[]

object (TrainingPhrase)

The collection of training phrases the agent is trained on to identify the intent.

parameters[]

object (Parameter)

The collection of parameters associated with the intent.

priority

integer

The priority of this intent. Higher numbers represent higher priorities.

  • If the supplied value is unspecified or 0, the service translates the value to 500,000, which corresponds to the Normal priority in the console.
  • If the supplied value is negative, the intent is ignored in runtime detect intent requests.
isFallback

boolean

Indicates whether this is a fallback intent. Currently only default fallback intent is allowed in the agent, which is added upon agent creation. Adding training phrases to fallback intent is useful in the case of requests that are mistakenly matched, since training phrases assigned to fallback intents act as negative examples that triggers no-match event.

TrainingPhrase

Represents an example that the agent is trained on to identify the intent.

JSON representation
{
  "id": string,
  "parts": [
    {
      object (Part)
    }
  ],
  "repeatCount": integer
}
Fields
id

string

Output only. The unique identifier of the training phrase.

parts[]

object (Part)

Required. The ordered list of training phrase parts. The parts are concatenated in order to form the training phrase.

Note: The API does not automatically annotate training phrases like the Dialogflow Console does.

Note: Do not forget to include whitespace at part boundaries, so the training phrase is well formatted when the parts are concatenated.

If the training phrase does not need to be annotated with parameters, you just need a single part with only the Part.text field set.

If you want to annotate the training phrase, you must create multiple parts, where the fields of each part are populated in one of two ways:

  • Part.text is set to a part of the phrase that has no parameters.
  • Part.text is set to a part of the phrase that you want to annotate, and the parameterId field is set.
repeatCount

integer

Indicates how many times this example was added to the intent.

Part

Represents a part of a training phrase.

JSON representation
{
  "text": string,
  "parameterId": string
}
Fields
text

string

Required. The text for this part.

parameterId

string

The parameter used to annotate this part of the training phrase. This field is required for annotated parts of the training phrase.

Parameter

Represents an intent parameter.

JSON representation
{
  "id": string,
  "entityType": string,
  "isList": boolean,
  "redact": boolean
}
Fields
id

string

Required. The unique identifier of the parameter. This field is used by training phrases to annotate their parts.

entityType

string

Required. The entity type of the parameter. Format: projects/-/locations/-/agents/-/entityTypes/<System Entity Type ID> for system entity types (for example, projects/-/locations/-/agents/-/entityTypes/sys.date), or projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/entityTypes/<Entity Type ID> for developer entity types.

isList

boolean

Indicates whether the parameter represents a list of values.

redact

boolean

Indicates whether the parameter content is logged in text and audio. If it is set to true, the parameter content will be replaced to parameter id in both request and response. The default value is false.

Methods

create

Creates an intent in the specified agent.

delete

Deletes the specified intent.

get

Retrieves the specified intent.

list

Returns the list of all intents in the specified agent.

patch

Updates the specified intent.