Documentation about IBM Watson® Assistant for IBM Cloud Pak® for Data has moved. For the most up-to-date version, see Creating intents.
Defining intents
Intents are purposes or goals that are expressed in a customer's input, such as answering a question or processing a bill payment. By recognizing the intent expressed in a customer's input, the Watson Assistant service can choose the correct dialog flow for responding to it.
Intent creation overview
-
Plan the intents for your application.
Consider what your customers might want to do, and what you want your application to be able to handle on their behalf. For example, you might want your application to help your customers make a purchase. If so, you can add a
#buy_something
intent. (The#
that is added as a prefix to the intent name helps to clearly identify it as an intent.) -
Teach Watson about your intents.
After you decide which business requests that you want your application to handle for your customers, you must teach Watson about them. For each business goal (such as
#buy_something
), you must provide at least 5 examples of utterances that your customers typically use to indicate their goal. For example,I want to make a purchase.
Ideally, find real-world user utterance examples that you can extract from existing business processes. The user examples should be tailored to your specific business. For example, if you are an insurance company, a user example might look more like this,
I want to buy a new XYZ insurance plan.
The examples that you provide are used by your assistant to build a machine learning model that can recognize the same and similar types of utterances and map them to the appropriate intent.
Start with a few intents, and test them as you iteratively expand the scope of the application.
Creating intents
-
Open your dialog skill. The skill opens to the Intents page.
-
Select Create intent.
-
In the Intent name field, type a name for the intent.
- The intent name can contain letters (in Unicode), numbers, underscores, hyphens, and periods.
- The name cannot consist of
..
or any other string of only periods. - Intent names cannot contain spaces and must not exceed 128 characters. The following are examples of intent names:
#weather_conditions
#pay_bill
#escalate_to_agent
A number sign
#
is prepended to the intent name automatically to help identify the term as an intent. You do not need to add it.Optionally add a description of the intent in the Description field.
-
Select Create intent to save your intent name.
-
In the User example field, type the text of a user example for the intent. An example can be any string up to 1,024 characters in length. The following utterances might be examples for the
#pay_bill
intent:I need to pay my bill.
Pay my account balance
make a payment
To learn about the impact of including references to entities in your user examples, see How entity references are treated.
Intent names and example text can be exposed in URLs when an application interacts with Watson Assistant. Do not include sensitive or personal information in these artifacts.
-
Click Add example to save the user example.
-
Repeat the same process to add more examples.
Provide at least five examples for each intent.
-
When you are done adding examples, click to finish creating the intent.
The system begins to train itself on the intent and user examples you added.
How entity references are treated
When you include an entity mention in a user example, the machine learning model uses the information in different ways in these scenarios:
- Referencing entity values and synonyms in intent examples
- Annotated mentions
- Directly referencing an entity name in an intent example
Annotated mentions
As you define entities, you can annotate mentions of the entity directly from your existing intent user examples. A relationship that you identify in this way between the intent and the entity is not used by the intent classification model. However, when you add the mention to the entity, it is also added to that entity as new value. And when you add the mention to an existing entity value, it is also added to that entity value as new synonym. Intent classification does use these types of dictionary references in intent user examples to establish a weak reference between an intent and an entity.
For more information about contextual entities, see Adding contextual entities.
Directly referencing an entity name in an intent example
This approach is advanced. If used, it must be used consistently.
You can choose to directly reference entities in your intent examples. For instance, say that you have an entity that is called @PhoneModelName
, which contains values Galaxy S8, Moto Z2, LG G6, and Google Pixel 2.
When you create an intent, for example #order_phone
, you might then provide training data as follows:
- Can I get a
@PhoneModelName
? - Help me order a
@PhoneModelName
. - Is the
@PhoneModelName
in stock? - Add a
@PhoneModelName
to my order.
Currently, you can only directly reference synonym entities that you define (pattern values are ignored). You cannot use system entities.
If you choose to reference an entity as an intent example (for example, @PhoneModelName
) anywhere in your training data it cancels the value of using a direct reference (for example, Galaxy S8) in an intent example
anywhere else. All intents will then use the entity-as-an-intent-example approach. You cannot apply this approach for a specific intent only.
In practice, this means that if you have previously trained most of your intents based on direct references (Galaxy S8), and you now use entity references (@PhoneModelName
) for just one intent, the change impacts your
previous training. If you do choose to use @Entity
references, you must replace all previous direct references with @Entity
references.
Defining one example intent with an @Entity
that has 10 values that are defined for it does not equate to specifying that example intent 10 times. The Watson Assistant service does not give that much weight to
that one example intent syntax.
Testing your intents
After you have finished creating new intents, you can test the system to see if it recognizes your intents as you expect.
-
Click Try it.
-
In the Try it out pane, enter a question or other text string and press Enter to see which intent is recognized. If the wrong intent is recognized, you can improve your model by adding this text as an example to the correct intent.
If you have recently made changes in your skill, you might see a message that indicates that the system is still retraining. If you see this message, wait until training completes before testing:
The response indicates which intent was recognized from your input.
-
If the system does not recognize the correct intent, you can correct it. To correct the recognized intent, select the displayed intent and then select the correct intent from the list. After your correction is submitted, the system automatically retrains itself to incorporate the new data.
-
If the input is unrelated to any of the intents in your application, you can teach your assistant that by selecting the displayed intent, and then clicking Mark as irrelevant.
For more information about this action, see Teaching your assistant about topics to ignore.
If your intents are not being correctly recognized, consider making the following kinds of changes:
- Add the unrecognized text as an example to the correct intent.
- Move existing examples from one intent to another.
- Consider whether your intents are too similar, and redefine them as appropriate.
Absolute scoring
The Watson Assistant service scores each intent’s confidence independently, not in relation to other intents. This approach adds flexibility; multiple intents can be detected in a single user input. It also means that the system might not return
an intent at all. If the top intent has a low confidence score (less than 0.2), the top intent is included in the intents array that is returned by the API, but any nodes that condition on the intent are not triggered. If you want to detect
the case when no intents with good confidence scores were detected, use the irrelevant
special condition in your dialog node. See Special conditions for more information.
As intent confidence scores change, your dialogs might need restructuring. For example, if a dialog node uses an intent in its condition, and the intent's confidence score starts to consistently drop below 0.2, the dialog node stops being processed. If the confidence score changes, the behavior of the dialog can also change.
Intent limits
Intents per skill | Examples per skill |
---|---|
2,000 | 25,000 |
Editing intents
You can click any intent in the list to open it for editing. You can make the following changes:
- Rename the intent.
- Delete the intent.
- Add, edit, or delete examples.
- Move an example to a different intent.
You can tab from the intent name to each example.
-
To move or delete an example, click the checkbox that is associated with it, and then click Move or Delete.
Searching intents
The search capability was introduced with the 1.5.0 release.
Use the Search feature to find user examples, intent names, and descriptions.
-
From the Intents page header, click the Search icon .
-
Submit a search term or phrase.
The first time you search for something, you might get a message that says the skill is being indexed. If so, wait a minute, and then resubmit the search term.
Intents that contain your search term are displayed.
Exporting intents
You can export a number of intents to a CSV file, so you can then import and reuse them for another Watson Assistant application.
-
Go to the Intents page.
-
To export all intents, meaning the intents listed on this and any additional pages, do not select any individual intents. Instead, click the Export all intents icon.
-
To export the intents that are listed on the current page only, select the checkbox in the header. This action selects all of the intents on the current page. Click Export.
-
To export one or more specific intents, select the intents that you want to export, and then click Export.
-
-
Specify the name and location in which to store the CSV file that is generated.
Importing intents and examples
If you have a large number of intents and examples, you might find it easier to import them from a comma-separated value (CSV) file than to define them one by one. Be sure to remove any personal data from the user examples that you include in the file.
-
Collect the intents and examples into a CSV file, or export them from a spreadsheet to a CSV file. The required format for each line in the file is as follows:
<example>,<intent>
where
<example>
is the text of a user example, and<intent>
is the name of the intent you want the example to match. For example:Tell me the current weather conditions.,weather_conditions Is it raining?,weather_conditions What's the temperature?,weather_conditions Where is your nearest location?,find_location Do you have a store in Raleigh?,find_location
Important: Save the CSV file with UTF-8 encoding and no byte order mark (BOM).
-
From the Intents page, click the Import icon , and then drag a file or browse to select a file from your computer.
Important: The maximum CSV file size is 10 MB. If your CSV file is larger, consider splitting it into multiple files and importing them separately.
The file is validated and imported, and the system begins to train itself on the new data.
You can view the imported intents and the corresponding examples on the Intents tab. You might need to refresh the page to see the new intents and examples.
Resolving intent conflicts
The Watson Assistant application detects a conflict when two or more intent examples in separate intents are so similar that Watson Assistant is confused as to which intent to use.
To resolve conflicts:
-
From the Intents page, review any intents with conflicts.
-
Click an intent with a conflict to open it. Find the user example that is causing the conflict, and then click Resolve conflicts.
-
Choose whether to delete the example from the intent or to move it to another intent.
Similar user examples are displayed for each intent. These examples are not necessarily in conflict. They are shown to give you a quick view of the other types of user examples that are defined for each intent. It provides you with context that can help you make a more informed decision.
Keep each intent as distinct and focused on one goal as possible. If you have two intents with multiple user examples that overlap, maybe you don't need two separate intents. You can move or delete user examples that don't directly overlap into one intent, and then delete the other.
-
To move a user example, click Move, and then click the intent where you want to move the example.
When deciding where to put an example, look for the intent that has synonymous, or nearly synonymous, examples.
If the exact same example is used by the other intent already, the move action only removes the example from the current intent. It does not add the same example to the other intent twice.
-
After moving or deleting the example, click Submit to resolve the conflict.
The Reset reverts your changes. Click the x to close the page without submitting your changes.
-
Repeat the previous steps to resolve other intents with conflicts.
Deleting intents
You can select a number of intents for deletion.
IMPORTANT: By deleting intents that you are also deleting all associated examples, and these items cannot be retrieved later. All dialog nodes that reference these intents must be updated manually to no longer reference the deleted content.
-
Go to the Intents page
-
To delete all intents, meaning the intents listed on this and any additional pages, do not select any individual intents. Instead, click the Delete all intents icon.
-
To delete the intents that are listed on the current page only, select the checkbox in the header. This action selects all of the intents that are listed on the current page. Click Delete.
-
To delete one or more specific intents, select the intents that you want to delete, and then click Delete.
-