Intents

Intents allow your skill to understand what the user wants it to do. An intent categorizes typical user requests by the tasks and actions that your skill performs. The PizzaBot’s OrderPizza intent, for example, labels a direct request, I want to order a Pizza, along with another that implies a request, I feel like eating a pizza.

Intents are comprised of permutations of typical user requests and statements, which are also referred to as utterances. As described in Create an Intent, you can create the intent by naming a compilation of utterances for a particular action. Because your skill’s cognition is derived from these intents, each intent should be created from a data set that’s robust (one to two dozen utterances) and varied, so that your skill can interpret ambiguous user input. A rich set of utterances enables a skill to understand what the user wants when it receives messages like “Forget this order!” or “Cancel delivery!”—messages that mean the same thing, but are expressed differently. To find out how sample user input allows your skill to learn, see Intent Training and Testing.

Create an Intent

To create an intent:
  1. Click Intents This is an image of the Intent icon. in the left navbar.
  2. If you already have defined your intents in a CSV file, click Import Intents. Import Intents from a CSV File describes this file's format. Otherwise, click Add Intent. Your skill needs at least two intents.
  3. Click This is an image of the Edit icon to enter a descriptive name or phrase for the intent in the Conversation Name field. For example, if the intent name is callAgent, the conversation name would be Talk to a customer representative. When the skill can't resolve a message to an intent, it outputs the user-friendly names and phrases that you enter into the Conversation Name field as the options that are listed in the Do you want to disambiguation messages described in How Confidence Win Margin Works and Configure the Intent and Q&A Routing.
  4. Add the intent name in the Name field. If you don't enter a conversation name, then the Name field value is used instead. Keep in mind that a short name with no end punctuation might not contribute to the user experience. The intent name displays in the Conversation Name field for skills built with prior versions of Digital Assistant.
    Note

    In naming your intents, do not use system. as a prefix. system. is a namespace that's reserved for the intents that we provide. Because intents with this prefix are handled differently by Trainer Tm, using it may cause your intents to resolve in unexpected ways.
  5. As a optional step, add description of the intent. Your description should focus on what makes the intent unique and the task or actions it performs.
  6. If this is an answer intent, add a short answer to the Answer field.
  7. Start building the training corpus by adding example utterances that illustrate the meaning behind the intent. To ensure optimal intent resolution, use terms, wording, and phrasing specific to the individual intent. Ideally, you should base your training data on real-world phrases. You can save your utterances by clicking Enter or by clicking outside of the input field. To manage the training set, select a row to access the Edit (This is an image of the Edit button.) and Delete (This is an image of the Delete function.) functions.
    If your skill supports multiple native languages, augment the training set with phrases in the secondary languages to strengthen the model's accuracy in this and all other native languages supported by the skill.
    Description of select_additional_language.png follows

    See Build Your Training Corpus for tips on building an effective training corpus.
    To allow your skill to cleanly distinguish between intents, create an intent that resolves inappropriate user input or gibberish.
    While utterances can be added to an existing intent manually or by importing a CSV, they can also be assigned to intents through data manufacturing jobs and the Insights retrainer.
  8. In the Auto-Complete Suggestions field, enter a set of suggested phrases that help the user enter an appropriately worded request. Do not add the entire set of training data. Add a set of phrases that represent ideal user requests instead. Adding too broad a set of utterances may not only confuse users, but may also result in unexpected behavior.
    This is an optional step. This function is only supported by the Oracle Web Channel.
  9. Add an entity if the intent needs one to resolve the user input. To find out how, see Add Entities to Intents.
  10. To teach your skill how to comprehend user input using the set of utterances that you’ve provided so far, click Train, choose a model and then click Submit.
    As described in Which Training Model Should I Use?, we provide two models that learn from your corpus: Trainer Ht and Trainer Tm. Each uses a different algorithm to reconcile the user input against your intents. Trainer Ht uses pattern matching while Trainer Tm a machine learning algorithm which uses word vectors. Both skills that use Digital Assistant's native language support and skills with answer intents require Trainer TM.
    You’d typically follow this process:
    1. Create the initial training corpus.

    2. Train with Trainer Ht. You should start with Trainer Ht because it doesn’t require a large set of utterances. As long as there are enough utterances to disambiguate the intents, your skill will be able to resolve user input.

      If you get a Something’s gone wrong message when you try to train your skill, then you may not have added a sufficient number of utterances to support training. First off, make sure that you have at least two intents with at least two (or preferable more) utterances each. If you haven’t added enough utterances, add a few more then train your skill.

    3. Refine your corpus, retrain with Trainer Ht. Repeat as necessary—training is an iterative process.

    4. Train with Trainer Tm. Use this trainer when you’ve accumulated a robust set of intents.

    The Training Needed displays whenever you add an intent or when you update an intent by adding, changing, or deleting its utterances. To bring the training up to date, choose a training model and then click Train. The model displays an exclamation point whenever it needs training. When its training is current, it displays a check mark.

  11. Click Test Utterances (located at the upper left) to open the Utterance Tester. Select the target language, then enter utterances similar to those in your training set. The Utterance Tester returns the confidence level for this utterance and enables you to assign the utterance to an intent, or add it as a test case.
    To log your intent testing results, enable the conversation intent logging (Settings > General > Enable Insights) . Run a History Report describes how you use this data.
  12. Click Validate and review the validation messages for errors such as too few utterances and for guidance on applying best practices like adding an unresolvedIntent intent.

Add Entities to Intents

Some intents require entities—both built-in and custom— to complete an action within the dialog flow or make a REST call to a backend API. The system uses only these entities, which are known as intent entities, to fulfill the intent that’s associated with them. You can associate an entity to an intent when you click Add New Entity and then select from the custom (This is an image of the Custom icon.) or built-in (This is an image of the System icon.) entities. If you're assigning a built-in entity, leave Value Agnostic enabled (the default) if specific entity values do not factor into intent classification (which is generally the case). If the intent requires a specific entity value, switch this feature off.
Note

Value Agnostic applies to built-in entities only. You cannot apply it to custom entities.

Description of choose_req_entity.png follows

Alternatively, you can click New Entity to add an intent-specific entity.
Description of create_intent_entity.png follows

Tip:

Only intent entities that are included in the JSON payloads are sent to, and returned by, the Component Service. The ones that aren’t associated with an intent won’t be included, even if they contribute to the intent resolution by recognizing user input. If your custom component accesses entities through entity matches, then be sure to add the entity to your intent.
Value Agnostic Intent Entities

The Value Agnostic feature allows you to adjust how entity values affect intent classification. When you enable this feature, the specific values for an associated built-in entity do not have bearing on the intent classification. However, when you disable this feature, you allow the entity value to play a key role in resolving the input.

In general, you can leave this feature in its default setting (enabled) because a specific entity value seldom factors into intent classification. The training utterances for an account balances intent, for example, may include specific dates (What was my balance on October 5?) but these values are not the deciding factor in resolving the input to the intent. Leaving Value Agnostic enabled will, in most cases, improve intent resolution because it prevents the values from affecting confidence scores or even signaling an unintended intent. However, whenever specific values play a key role in intent resolution, you should switch this feature off. For example, you would disable the feature if the value for a DATE is central to distinguishing an intent for checking past vacation balances from an intent that checks for future vacation balances. If these intents were date agnostic, then the model would ignore past and present and would not resolve input correctly.
Example Intents Associated Entity Training Utterances Enable Value Agnostic?
Account Balance DATE
  • Can you tell me my account balance yesterday?
  • How much money do I have in checking?
  • What was my balance on October 5th?
  • What was my credit card balance last week?
  • What is my bank balance today?
  • What was my savings account balance on 5/3?
Yes – The specific date values do not signal the intent. The various date values in these utterances can be ignored because a user can ask for an account balance on any day.
Holiday Store Hours DATE
  • Are you open on January 1st?
  • Are you open on Thanksgiving?
  • Hours for New Year's Day
  • What are the store hours for July 4th?
  • What are your holiday hours?
  • Will you be open on Christmas?
No – The intent classification is based on a specific (and limited) set of values and users are inquiring about holidays.
  • Check Past Vacation Balance
  • Check Future Vacation Balance
DATE
  • Check Past Vacation Balance
    • Did I take any time off last month?
  • Check Future Vacation Balance
    • Any planned vacation in next month?
No – Disable Value Agnostic for both intents. Agnostic DATE values in this case would mean that the model would not consider a value as past or future. A "last month" value, which should signal the Check Past Vacation Balance intent, would be ignored. As a result, similarly worded input like "Did I take any time off next month" may resolve incorrectly to this intent.

Import Intents from a CSV File

You can add your intents manually, or import them from a CSV file. You can create this file from a CSV of exported intents, or by creating it from scratch in a spreadsheet program or a text file.

The CSV file has six columns for skills that use the Natively-Supported language mode and five columns for those that don't. Here are the column names and what they represent:

  • query: An example utterance.
  • topIntent: The intent that the utterance should match to.
  • conversationName: The conversation name for the intent.
  • answer: For answer intents, the static answer for the intent.
  • enabled: If true, the intent is enabled in the skill.
  • nativeLanguageTag: (For skills with native-language support only) the language of the utterance. For values, use two-character language tags (fr, en, etc,).
    • For skills with Digital Assistant's native language support, this column is required.
    • For skills without the native language support, you can't import a CSV that has this column.

Here's an excerpt from a CSV file for a skill that does not have native language support and which doesn't use answer intents.

query,topIntent,conversationName,answer,enabled
I want to order a pizza,OrderPizza,Order a Pizza.,,true
I want a pizza,OrderPizza,Order a Pizza.,,true
I want a pizaa,OrderPizza,Order a Pizza.,,true
I want a pizzaz,OrderPizza,Order a Pizza.,,true
I'm hungry,OrderPizza,Order a Pizza.,,true
Make me a pizza,OrderPizza,Order a Pizza.,,true
I feel like eating a pizza,OrderPizza,Order a Pizza.,,true
Gimme a pie,OrderPizza,Order a Pizza.,,true
Give me a pizza,OrderPizza,Order a Pizza.,,true
pizza I want,OrderPizza,Order a Pizza.,,true
I do not want to order a pizza,CancelPizza,Cancel your order.,,true
I do not want this,CancelPizza,Cancel your order.,,true
I don't want to order this pizza,CancelPizza,Cancel your order.,,true
Cancel this order,CancelPizza,Cancel your order.,,true
Can I cancel this order?,CancelPizza,Cancel your order.,,true
Cancel my pizza,CancelPizza,Cancel your order.,,true
Cancel my pizaa,CancelPizza,Cancel your order.,,true
Cancel my pizzaz,CancelPizza,Cancel your order.,,true
I'm not hungry anymore,CancelPizza,Cancel your order.,,true
don't cancel my pizza,unresolvedIntent,unresolvedIntent,,true
Why is a cheese pizza called Margherita,unresolvedIntent,unresolvedIntent,,true

Here's an excerpt from a CSV file for a skill with native-language support that uses answer intents.

query,topIntent,conversationName,answer,enabled,nativeLanguageTag
Do you sell pasta,Products,Our Products,We sell only pizzas. No salads. No pasta. No burgers. Only pizza,true,en
Vendez-vous des salades,Products,Our Products,Nous ne vendons que des pizzas. Pas de salades. Pas de pâtes. Pas de hamburgers. Seulement pizza,fr
do you sell burgers,Products,Our Products,We sell only pizzas. No salads. No pasta. No burgers. Only pizza,true,en
Do you sell salads,Products,Our Products,We sell only pizzas. No salads. No pasta. No burgers. Only pizza,true,en
Vendez des hamburgers,Products,Our Products,Nous ne vendons que des pizzas. Pas de salades. Pas de pâtes. Pas de hamburgers. Seulement pizza,true,fr

To import a CSV file:

  1. Click Intents (This is an image of the Intent icon.) in the left navbar.

  2. Click More, and then choose Import intents.
    Description of import_intents.png follows

  3. Select the .csv file and then click Open.

  4. Train your skill.

Export Intents to a CSV File

You can reuse your training corpus by exporting it to CSV. You can then import this file to another skill.

To export your intents and their utterances:
  1. Click Intents This is an image of the Intent icon. in the left navbar.

  2. Click More, and then choose Export intents.
    Description of export_corpus.png follows

  3. Save the file. This file has the following columns, which are described in Import Intents from a CSV File:
    query, topIntent, conversationName, answer, enabled, nativeLanguageTag

Which Training Model Should I Use?

We provide a duo of training models that mold your skill’s cognition, Trainer Tm and Trainer Ht. You can use either of these models, each of which uses a different approach to machine learning. In general, you train your with Trainer Tm before you put your skills into production. Because of its shorter training time, you can use Ht for prototyping or for skills.
Note

You can't use Trainer Ht for skills that use answer intents, use native language support, or have a large number of intents. Use Trainer Tm for these skills.
Trainer Ht is the default model, but you can change this by clicking Settings > General and then by choosing another model from the list. The default model displays in the tile in the skill catalog.
Trainer Tm
Trainer Tm (Tm) achieves highly accurate intent classification when a skill has Answer Intents or transactional intents that number in the hundreds, or even thousands. Even though the intents in these large data sets are often closely related and are sometimes "unbalanced" in terms of their utterances (some have many, while others have one or two), Tm can still differentiate between them. In general, you would apply Tm to any skill before you put it into production.
Note

When you train with Trainer Tm, you can also use the Similar Utterances Report.

You don't need to bulk up your training data with utterances that accommodate case sensitivity (Tm recognizes BlacK Friday as Black Friday, for example), punctuation, similar verbs and nouns, or misspellings. In the latter case, Trainer Tm uses context to resolve a phrase even when a user enters a key word incorrectly. Here are some general guidelines for building a training corpus when you're developing your skill with this model.

Trainer Tm enhances the skill's cognition by
  • Recognizing the irrelevant content. For I'm really excited about the coming Black Friday deals, and can't wait for the deals. Can you tell me what's going to be on sale for Black Friday?, Trainer Tm:
    • Discards the extraneous content (I'm really excited about the coming Black Friday deals...)
    • Resolves the relevant content (Can you tell me what's going to be on sale for Black Friday?) to an intent. In this case, an intent called Black Friday Deals.
    Trainer Tm can also distinguish between the relevant and irrelevant content in a message even when the irrelevant content can potentially be resolved to an intent. I bought the new 80 inch TV on Black Friday for $2200, but now I see that the same set is available online for $2100. Do you offer price match? for example, could be matched to the Black Friday Deals intent and to a Price Matching intent, which is appropriate for this message. In this case Trainer Tm:
    • Recognizes that I bought the new 80 inch TV on Black Friday for $2200, but now I see that the same set is available online for $2100 is extraneous content.
    • Resolves Do you offer price match?
  • Resolving intents when a single word or a name matches an entity. For example, Trainer Tm can resolve a message consisting of only Black Friday to an intent that's associated with a entity for Black Friday.
  • Distinguishing between similar utterances (Cancel my order vs. Why did you cancel my order?).
  • Recognizing out-of-scope utterances, such as Show me pizza recipes or How many calories in a Meat Feast for a skill for fulfilling a pizza order and nothing else.
  • Recognizing out-of-domain utterances, such as What's the weather like today for a pizza ordering skill.

    Tip:

    While Trainer Tm can easily distinguish when a user message is unclassifiable because it's clearly dissimilar from the training data, you should still define an unresolvedIntent with utterances that represent the phrases that you do not want resolved to any of your skill's intents. These phrases can be within the domain of your skill, but are still out of scope, even though they may share some of the same words as the training data. For example, I want to order a car for a pizza skill, which has also been trained with I want to order a pizza.
  • Distinguishing between similar entities – For example, Tm recognizes that mail is not same as email in the context of an intent called Sign Up for Email Deals. Because it recognizes that an entity called regular mail would be out of scope, it would resolve the phrase I want to sign up for deals through regular mail at a lower confidence than it would for I want to sign up for email deals.
Trainer Ht

Trainer Ht is the default training model. It needs only a small training corpus, so use it as you develop the entities, intents, and the training corpus. When the training corpus has matured to the point where tests reveal highly accurate intent resolution, you’re ready to add a deeper dimension to your skill’s cognition by training Trainer Tm.

You can get a general understanding of how Trainer Ht resolves intents just from the training corpus itself. It forms matching rules from the sample sentences by tagging parts of speech and entities (both custom and built-in) and by detecting words that have the same meaning within the context of the intent. If an intent called SendMoney has both Send $500 to Mom and Pay Cleo $500, for example, Trainer Ht interprets pay as the equivalent to send . After training, Trainer Ht’s tagging reduces these sentences to templates (Send Currency to person, Pay person Currency) that it applies to the user input.

Because Trainer Ht draws on the sentences that you provide, you can predict its behavior: it will be highly accurate when tested with sentences similar to the ones that make up the training corpus (the user input that follows the rules, so to speak), but may fare less well when confronted with esoteric user input.

Build Your Training Corpus

When you define an intent, you first give it a name that illustrates some user action and then follow up by compiling a set of real-life user statements, or utterances. Collectively, your intents, and the utterances that belong to them, make up a training corpus. The term corpus is just a quick way of saying “all of the intents and sample phrases that I came up with to make this skill smart”. The corpus is the key to your skill’s intelligence. By training a model with your corpus, you essentially turn that model into a reference tool for resolving user input to a single intent. Because your training corpus ultimately plays the key role in deciding which route the skill-human conversation will take, you need to choose your words carefully when building it.

Generally speaking, a large and varied set of sample phrases increases a model’s ability to resolve intents accurately. But building a robust training corpus doesn’t just begin with well-crafted sample phrases; it actually begins with intents that are clearly delineated. Not only should they clearly reflect your use case, but their relationship to their sample sentences should be equally clear. If you’re not sure where a sample sentence belongs, then your intents aren’t distinct from one another.

You probably have sample utterances in mind when you create your intents, but you can expand upon them by using these guidelines.

Guidelines for Trainer Tm
  • Use a minimum Confidence Threshold of 0.7 for any skill that you plan to put into production.
  • Use good naming conventions for your intent names so it's easy to review related intents.
  • As a general rule, create at least 80 to 100 utterances for each intent.
  • If possible, use unmodified, real-word phrases that include:
    • vernacular
    • standard abbreviations that a user might enter ("opty" for opportunity, for example)
    • non-standard names, such a product names
    • spelling variants ("check" and "cheque", for example)
    If you don't have any actual data, incorporate these in your own training data. Here are some pointers:
    • Create fully formed sentences that mention both the action and the entity on which the action is performed.
    • If you expect two-word messages like order status, price check, membership info, or ship internationally) that specify both the entity and action, add them to your training data. Be sure that your sample phrases have both an action and an entity.
    • Be specific. For example, What is your store phone number? is better than What is your phone number? because it enables Trainer Tm to associate a phone number with a store. As a result of this learning, it will resolve What's your mom's phone number? to a lower confidence score.
    • While Trainer Tm detects out-of-scope utterances, you can still improve confidence and accuracy by creating an unresolvedIntent for utterances that are in domain but still out of scope for the skill's intents. This enables Trainer Tm to learn the boundary of domain intents. You can define an unresolvedIntent for phrases that you do not want resolved to any of your skill's intents. You may only want to define an unresolvedIntent when user messages have been resolved to a skill's intents even when they don't apply to any of them.
    • Vary the words and phrases that surround the significant content as much as possible. For example, I'd like a pizza, please", "Can you get me a pizza?", "A pizza, please"
    • Some practices to avoid:
      • Do not associate a single word or phrase with a specific intent unless that word or phrase indicates the intent. Repeated phrases can skew the intent resolution. For example, starting each OrderPizza utterance with "I want to …" and each ShowMenu intent with "Can you help me to …" may increase the likelihood of the model resolving any user input that begins with "Can you help me to" with OrderPizza and "I want to" with ShowMenu.
      • A high occurrence of one-word utterances in your intents. One-word utterances are an exception. Use them sparingly, if at all.
      • Open-ended utterances that can easily apply to other domains or out-of-domain topics.
      • Your corpus doesn't need to repeat the same utterance with different casing or with different word forms that have same lemma. For example, because Trainer Tm can distinguish between manage, manages, and manager, it not only differentiates between "Who does Sam manage?" and "Who manages Sam?", but also understands that these words are related to one another.
        Note

        You may be tempted to add misspellings of words. But before you do, use those misspellings in the utterance tester to see if the model recognizes them. You might be surprised at how well it handles them. Also, by not adding misspellings you run less risk of skewing your model in unexpected ways.
  • Create test cases to ensure the integrity of the intent resolution.
  • Run utterance quality reports to maintain a set of intents that are distinct from one another.
  • When you deploy your skill, you can continuously improve the training data by:
    • Reviewing the Conversation Logs, summaries of all conversations that have occurred for a specified period. You enable the logging by switching Enable Insights on in Settings.
    • Running Quality Reports and by assigning (or reassigning) actual user messages to your intents with the Insights Retrainer. If these reports indicate that unresolvedIntent has a lot of misclassified utterances within the domain intents:
      • Move the in-scope utterances from unresolvedIntent to the domain intents.
      • Move the out-of-scope utterances from the domain intents to unresolvedIntent.
Guidelines for Trainer Ht
Create 12 to 24 sample phrases per intent, if possible. Use unmodified, real-word phrases that include:
  • vernacular
  • common misspellings
  • standard abbreviations that a user might enter ("opty" for "opportunity", for example)
  • non-standard names, such a product names
  • spelling variants ("check" and "cheque", for example)
If you don't have any actual data, incorporate these in your own training data. Here are some pointers:
  • Vary the vocabulary and sentence structure in these starter phrases by one or two permutations using:
    • slang words (moolah, lucre, dough)

    • standard abbreviations that a user might enter ("opty" for opportunity, for example)
    • non-standard names, such a product names
    • common expressions (Am I broke? for an intent called AccountBalance)

    • alternate wording (Send cash to savings, Send funds to savings, Send money to savings, Transfer cash to savings.)

    • different categories of objects (I want to order a pizza, I want to order some food).

    • alternate spellings (check, cheque)

    • common misspellings ("buisness" for business)

    • unusual word order (To checking, $20 send)

  • Use different concepts to express the same intent, like I am hungry and Make me a pizza
  • Do not associate a single word or phrase with a specific intent unless that word or phrase indicates the intent. Repeated phrases can skew the intent resolution. For example, starting each OrderPizza utterance with "I want to …" and each ShowMenu intent with "Can you help me to …" may increase the likelihood of the model resolving any user input that begins with "I want to" with OrderPizza and "Can you help me to" with ShowMenu.
  • Avoid sentence fragments and single words. Instead, use complete sentences (which can be up to 255 characters) that include the action and the entity. If you must use single key word examples, choose them carefully.

  • Create test cases to ensure the integrity of the test the intent resolution. Because adding a new intent examples can cause regressions, you might end up adding several test phrases to stabilize the intent resolution behavior.
  • Run utterance quality reports to maintain a set of intents that are distinct from one another.

Export Intent Data

To log conversations, be sure to enable Enable Insights in Settings > General before you test your intents.

To export data for a skill:
  1. Click icon to open the side menu to open the side menu and select Development > Skills.
  2. In the tile for the skill, click icon to open the Options menu and select Export Conversations.
  3. Choose Intent Conversation Log, set the logging period, and then click Export.
  4. Review the user input by opening the CSV files in a spreadsheet program.

Intent Training and Testing

Training a model with your training corpus allows your bot to discern what users say (or in some cases, are trying to say).

You can improve the acuity of the cognition through rounds of intent testing and intent training. You control the training through the intent definitions alone; the skill can’t learn on its own from the user chat.

Testing Utterances

We recommend that you set aside 20% percent of your corpus for intent testing and use the remaining 80% to train your intents. Keep these two sets separate so that the test utterances, which you incorporate into test cases, remain "unknown" to your skill.

Apply the 80/20 split to the each intent's data set. Randomize your utterances before making this split to allow the training models to weigh the terms and patterns in the utterances equally.

The Utterance Tester

The Utterance Tester is your window into your skill’s cognition. By entering phrases that are not part of the training corpus, you can find out how well you’ve crafted your intents by reviewing the intent confidence ranking and the returned JSON. This ranking, which is the skill’s estimate for the best candidate to resolve the user input, demonstrates its acuity at the current time.
Description of utterance_tester_quick_test.png follows

Using the Utterance Tester, you can perform quick tests, for one-off, on-the-fly testing, or you can incorporate an utterance as a test case that gauges intent resolution across different versions of training models.

Quick Tests
To find out how well your intents work:
  1. Click Test Utterances (located at the left side).
  2. If your skill supports multiple native languages, choose the testing language. Choosing this option ensures that the utterance will be added to corresponding language version of the corpus. The skill's primary language is selected by default.
  3. Enter a string of text.
  4. Click Test and then take a look at the ranking and the entities detected in the utterance (if any).
  5. Review the Intent Confidence scores. (The progress bars for each intent listed are green if they meet or exceed the Confidence Level or red if they fall short).
    If your skill’s top-ranking candidate isn’t what you expect, you might need to retrain the intents after doing one or both of the following:
    • Update the better candidate’s corpus with the input text that you just entered—Select the appropriate intent and then click Add to Intent.

      Caution:

      Consider the impact on your training data before you add a test phrase. Adding a test phrase can change how the utterances that are similar to it get classified after retraining. In addition, adding a test phrase invalidates the test, because the incorporation of a test phrase into the training set ensures that the test will be successful. Rather than adding a test phrase to the traininig data, you should instead save it as a test case.
    • In the Intents page, you can edit an utterance Edit (This is an image of the Edit button.) or remove it. A FAQ intent, for example, might receive a top rank because of the scope and phrasing of its constituent utterances. If you don’t want your users to get a FAQ whenever they ask typical questions, you’ll need to revise the corpus.

    You need to retrain an intent whenever you add, change, or delete an utterance. Training Needed This is an image of the Training Needed indicator. displays whenever you make a change to the training data.

  6. If your intents aren't resolving as intended, you can expand the JSON window to review the matched intents, scores, and detected entities in the returned JSON.
  7. Click Reset.
Test Cases

Test cases validate intent resolution. Each test case includes an utterance and its expected intent. You can apply test cases both in development and for regression testing when skills are in production. In the latter case, you can run test cases to find out if a new release of the training model has negatively affected intent resolution.

Like the test cases that you create with the Conversation Tester, utterance test cases are part of the skill and are carried along with each version. If you extend a skill, then the extension inherits the test cases. Whereas conversation test cases are intended to test a scenario, utterance test cases are intended to test fragments of a conversation independently, ensuring that each utterance resolves to the correct intent.

Manage Test Cases

The Test Cases page, accessed by clicking Go to Test Cases in the Utterance Tester, lists the test cases that you've created, or that have been inherited from a skill that you've extended, or cloned. You can edit these test cases from this page, add new ones, remove test cases and run tests in bulk (batch test). You can review these results (the test runs) and analytics from the Test Results page.

Create Utterance Test Cases

You can add test cases one-by-one using either Utterance Tester or the New Test Case dialog (accessed by clicking + Test Case), or you can add them in bulk by uploading a CSV.

Each test case must belong to a test suite, so before you create a test case, you may want to first create a test suite that reflects some aspect of intent testing, such as failure testing, in-domain testing, or out-of-domain testing. Each test suite may contain thousands of test cases. We provide an OOTB suite called Default Test Suite. You can assign test cases to this test suite if you haven't yet created any others. Later on, you can edit the test case to reassign it to a new test suite, if needed.

Add Test Cases from the Utterance Tester
In addition to adding utterances to the training corpus, you can use the Quick Test page to create a test case:
  1. Click Test Utterances.
  2. If the skill is multi-lingual, select the native language.
  3. Enter the utterance then click Test.
  4. Click Save as Test Case then choose a test suite.
Create a Test Case
To create a single test case:
  1. Click Go to Test Cases in the Utterance Tester.
  2. Click + Test Case.
  3. Complete the New Test Case dialog:
    • If needed, disable the test case.
    • Enter the test utterance.
    • Select the test suite.
    • Select the expected intent. If you're creating a test case for failure testing, select unresolvedIntent.
    • For multi-lingual skills, select the language tag and the expected language.
  4. Click Add to Suite. You can then edit or delete the test case from the Test Cases page.
Import Test Cases for Skill-Level Test Suites
From the Test Cases page (accessed by clicking Go to Test Cases in the Utterance Tester), you can add test suites and their cases in bulk by clicking More > Import to import a CSV with the following columns:
  • testSuite – If you don't name a test suite, the test cases will be added to Default Test Suite.
  • utterance – An example utterance (required). Maps to query in pre-21.04 versions of Oracle Digital Assistant.
  • expectedIntent – The matching intent (required). Maps to TopIntent in pre-21.04 versions of Oracle Digital Assistant.
  • enabledTRUE includes the test case in the test run. FALSE excludes it.
  • languageTag – The language tag (en, for example). This is mandatory.
  • expectedLanguageTag – Optional

Description of utterance_test_case_csv_example.png follows

While you can load pre-21.04 versions of CSVs for bulk testing that use the query and TopIntent columns, the resulting test cases will be added to the Default Test Suite. You can edit these test cases individually to assign them to another test suite through the user interface, or you can update the CSV to the current format by importing it:
  1. Click More > Import.
  2. After the import completes, select Default Test Suite, then click More > Export Selected Suite. The exported file will be in the current format.
  3. Extract the ZIP file and edit the CSV. When you've finished, click More > Import. Keep in mind that you may need to delete duplicate test cases from the Default Test Suite.
    Note

    If you upload the same CSV multiple times with minor changes, any new or updated data will be merged with the old: new updates are applied and new rows are inserted. However, you can't delete any utterances by uploading a new CSV. If you need to delete utterances, delete and then recreate it by importing a CSV.
Create Test Runs
Test runs enable you to evaluate your test cases on each iteration of your skill. You can review test run results to find out if changes made to the platform, or to the skill itself, have compromised the accuracy of the intent resolution.

To create a test run:

  1. Click Run All to create a test run for all of the test cases in a selected test suite. (Or if you want to run all test suites, select All then click Run All). To create a test run for a selection of test cases within a suite (or a test run for subset of all test cases if you selected All), filter the test cases by adding a string that matches the utterance text and an expected intent. Then click Run. For multi-lingual skills, you can also filter by Language Tag and Expected Language options (accessed through Optional Attributes).
  2. Enter a name for the test run. This is an optional step.
  3. Adjust the Confidence Threshold. Running a test suite with different thresholds helps you determine the optimal Confidence Threshold for your skill. The default value is the same as the skill's Confidence Threshold that's set in the Configuration page in Settings. You can change this value only for a single run; the value gets reset to the default after the testing concludes.
    Intents (including expected intents) that resolve below the Confidence Threshold are considered unresolved. Keep in mind that lowering the Confidence Threshold can shift the focus of the testing from matching the Confidence Threshold to merely matching the expected intent. The results from low Confidence Threshold testing may be unrealistic and may include false-positives when the skill is used in the real world.
    Description of new_test_run_dialog.png follows

    .
  4. Click Start.
  5. Click Test Results, then select the test run. Test runs for large test suites may take several minutes to complete. You can monitor the number of test cases that have yet to be executed using the In Progress indicator. When the test run completes, you can filter the results by clicking All, Passed (green), or Failed (red). Selecting a test case displays a breakdown of the test case's utterance by confidence and candidate intents. You can also view the JSON object containing the full results. When present, the report also identifies the entities contained in the utterance by entity name and value.
    Description of filtered_test_run_results_passed.png follows

    The test cases counted as skipped include both disabled test cases and test cases where the expected intent has been disabled.
  6. Click Analytics to compare the percentage of passing (green) and failing (red) test cases per intent the Result Distribution bar graph. Confidence Score Distribution, a horizontal bar chart, likewise employs red and green to contrast the distribution of passing confidence scores for the test cases in the run against the failing confidence scores.
    Description of test_run_analytics.png follows

Exported Test Runs

Test runs are not persisted with with the skill, but you can download them to your system for analysis by clicking Export Test Run. If the intents no longer resolve the user input as expected, or if platform changes have negatively impacted intent resolution, you can gather the details for an SR (service request) using the logs of exported test runs.

Failure Testing

Failure (or negative) testing enables you to bulk test utterances that should never be resolved, either because they result in unresolvedIntent, or because they only resolve to other intents below the Confidence Threshold for all of the intents.

To conduct failure testing:
  • Specify unresolvedIntent as the Expected Intent for all of the test cases that you expect to be unresolved. Ideally, these "false" phrases will remain unresolved.
    Description of new_test_case_utterance_unresolved.png follows

  • If needed, adjust the Confidence Threshold when creating a test run to confirm that the false phrases (the ones with unresolvedIntent as their expected intent) can only resolve below the value that you set here. For example, increasing the threshold might result in the false phrases failing to resolve at the confidence level to any intent (including unresolvedIntent), which means they pass because they're considered unresolved.
  • Review the test results, checking that the test cases passed by matching unresolvedIntent at the threshold, or failed to match any intent (unresolvedIntent or otherwise) at the threshold.

Similar Utterances

You can find out how similar your test phrase is to the utterances in the training corpus by clicking View Similar Utterances. This tool provides you with an added perspective on the skill's training data by showing you how similar its utterances are to the test phrase, and by extension, how similar the utterances are to one another across intents. Using this tool, you can find out if the similarity of the test phrase to utterances belonging to other intents is the reason why the test phrase is not resolving as expected. It might even point out where training data belongs to the wrong intent because if its similarity to the test phrase.
Description of similar_utterance_report_all_intents.png follows

The list generated by this tool ranks 20 utterances (along with their associated intents) that are closest to the test phrase. Ideally, the top-ranking utterance on this list – the one most like the test phrase – belongs to the intent that's targeted for the test phrase. If the closest utterance that belongs to the expected intent is further down, then a review of the list might provide a few hints as to why. For example, if you're testing a Transactions intent utterance, how much money did I transfer yesterday?, you'd expect the top-ranking utterance to likewise belong to a Transactions intent. However, if this test utterance is resolving to the wrong intent, or resolving below the confidence level, the list might reveal that it has more in common with highly ranked utterances with similar wording that belong to other intents. The Balances intent's How much money do I have in all of my accounts?, for example, might be closer to the test utterance than the Transactions intent's lower-ranked How much did I deposit in April? utterance.

You can access the list, which is generated for skills trained on Trainer Tm, by clicking View Similar Utterances in the Utterance Tester after you've run a quick test of the phrase.
Description of similar_utterances_tester.png follows

Note

You can only use this tool for skills trained on Trainer Tm (it's not available for skills trained with Ht).
You can query utterances from both the Utterance Tester and through testing in the View Similar Utterances tool itself. When you click View Similar Utterances, the entire corpus is compared against the test phrase and a ranking is applied to each utterance. Because no filters are applied by default, however, the list only includes the 20 top-rated utterances and numbers them sequentially. To find out how utterances ranked 21 and higher compared, you need to use the filters. By applying the following filters, you can learn the proximity of similar utterances within the ranking in terms of language, the intents they belong to, or the words or phrases that they have in common.
  • Filter by Intent – Returns 20 utterances that are closest to the test utterance that belong to the selected intent (or intents).
    Description of similar_utterance_report_filter_by_intent.png follows

  • Filter by Utterance – Returns 20 of the of utterances closest to the test utterance that contain a word or phrase.
    Description of similar_utterance_report_filter_by_utterance.png follows

  • Language – For multi-lingual skills, you can query and filter the report by selecting a language.
    Description of similar_utterance_report_filter_by_language.png follows

Note

Applying these filters does not change the rankings, just the view. An utterance ranked third, for example, will be noted as such regardless of the filter. The report's rankings and contents change only when you've updated the corpus and retrained the skill with Trainer Tm.

Tutorial: Best Practices for Building and Training Intents

Use this tutorial to find out about batch testing and other testing and training tips: Best Practices for Building and Training Intents.

Reference Intents in the Dialog Flow

Configuring intents as action transitions for the System.Intent component enables navigation to dialog states.
  intent:
    component: "System.Intent"
    properties:
      variable: "iResult"
    transitions:
      actions:
        OrderPizza: "resolvesize"
        CancelPizza: "cancelorder"
        unresolvedIntent: "unresolved"

Tune Intent Resolution Before Publishing

Before you publish a version of a skill (and thus freeze that version), you should thoroughly test it and, if necessary, adjust its settings to fine tune its intent resolution.

These settings help the System.Intent component resolve intents for the skill.

  • Confidence Threshold: Determines the minimum confidence level required for user input to match an intent. When the level falls below this minimum value for all of the skill's intents, the component triggers its unresolvedIntent action. It's recommended to set this value to .70 or higher.

  • Confidence Win Margin: When a skill has multiple intents that exceed the value of the Confidence Threshold, it displays a list of possible intents and prompts the user to choose one. This property helps the skill determine what intents should be in the list. Set the maximum level to use for the delta between the respective confidence levels for the top intents. The list includes the intents that are greater than or equal to this delta and exceed the value set for the Confidence Threshold.

To access these settings:

  • Click icon to open the side menu to open the side menu, select Development > Skills, and open your bot.

  • In the left navigation for the skill, click Settings icon and select the Configuration tab.

Note

Once you add a skill to a digital assistant, there is another range of settings that you may need to adjust to better handle intent resolution in the context of the digital assistant. See Tune Routing Behavior.

How Confidence Threshold Works

You use the Confidence Threshold property to adjust the likelihood that given user input will resolve to the skill's intents.

When you increase the Confidence Threshold, you increase the certainty that any matching intents are accurate (not false positives). However, this also increases the chance that intents that you want to match with certain input will not get high enough confidence scores for the matching to occur, thus resulting in matches to unresolvedIntent.

When you lower the value of the Confidence Threshold property, you reduce the chance that intents that you want to match will fail to match. However, the lower you set this threshold, the greater risk you have of generating false positives in your matches.

As a general rule the underlying language model works better with higher confidence thresholds, so you should set the Confidence Threshold to 70% (.70) or higher to get the best results.

To help decide on the value that you set for this parameter, adjust the Confidence Level in test runs to see which level works best for your skill.

How Confidence Win Margin Works

With the Confidence Win Margin property (accessed through Settings > Configuration), you can enable your skill to prompt users for an intent when the confidence scores for multiple intents are close. For example, if a user asks the FinancialBot, “I want to check balance or send money,” the skill responds with a select list naming the top intents, Check Balances and Send Money.

Description of win_margin_list.png follows

The skill offers these two intents in a select list, because its confidence in them exceeds the value set for the Confidence Threshold property and the difference between their respective confidence levels (that is, the win margin) is within value set for the Win Margin property.

Answer Intents

In some cases, a user's question requires only a single answer and no further conversation. Answer intents enable your skill to output these types of replies without you having to update the dialog definition.

You can create answer intents in the following ways:

  • Use the Knowledge feature to generate answer intents from an existing resource, such as an FAQ that is hosted on a web page or in a PDF document.
  • On the skill's Intents page, define answer intents like you would any other intent but also include an answer in the Answer field.
  • Do bulk creation of answer intents by uploading a CSV file.

Here are a few more things you need to know about answer intents:

  • Skills with answer intents need to be trained with Trainer Tm.
  • Unlike regular intents, you don't need to map answer intents to flows (in the Visual Flow Designer) or to states with System.Intent actions (in the YAML editor).
    • In the Visual Flow Designer, you can create a standard flow that handles all answer intents, map specific answer intents, or use a combination of the approaches.
    • In the YAML editor, you just need to have a System.Intent component to resolve the answer intents.
  • You can optionally store the answer intent in a resource bundle by clicking This is an image of the resource bundle icon.The resource bundle entries for answer intents are listed in the resource bundle's Q&A page.
    Description of qna_tab_rb.png follows

Generate Answer Intents from an Existing Knowledge Resource

If you already have a web page or PDF document with question and answer pairs, you can use the Knowledge feature to ingest those Q&A pairs from the document and generate answer intents automatically. (Any text in the document that does not follow the question/answer format is ignored.) When you create answer intents this way, example utterances are also generated for the intents.

To generate answer intents from a question and answer document:

  1. Click the Knowledge icon in the left navbar.
  2. Click + Knowledge Document.
  3. In the New Knowledge Document dialog:
    1. Specify a name and language for the document.

      For the language, you can select from the natively-supported languages that you have specified for your skill, except for Arabic.

    2. Select PDF and upload the document or select URL and provide the URL for an HTML web page.
    3. If the document is a PDF, select the checkbox acknowledging that it will be temporarily stored.
    4. Click Create.
    Note

    The URL option only works for HTML web pages. If you want to import an online PDF file, you need to first download it from the web page and then upload it into Digital Assistant.
  4. Wait for the generation of the answer intents to occur. This might take a few minutes.
  5. Once the job is completed, click Review Intents to go over the generated intents and training utterances. Pay particular attention to each question and answer to make sure that each contains the right text.

    Tip:

    For PDF documents, you can click Open PDF to view a color-coded version of the document to see what text was used to generate the intents and how it was divided into questions and answers.
  6. To edit an intent's name, question, answer, or utterances, click its Edit icon.
    Note

    You can also later edit these values on the Intents page.
  7. For an intents that you don't want added to the skill, clear the Include checkbox.
  8. Click Add Intents to Skill to add the generated intents to the skill.
  9. In the left navbar, click Intents This is an image of the Intent icon. and make any further adjustments to the intents, such as changing the conversation name and adding further example utterances.

Create a Single Answer Intent

If you need just a few answer intents, you can create them similarly to how you create regular intents.

  1. Click Intents This is an image of the Intent icon. in the left navbar.
  2. Click Add Intent.
  3. Click This is an image of the Edit icon to enter a descriptive name or phrase for the intent in the Conversation Name field.
  4. Add the intent name in the Name field. If you don't enter a conversation name, then the Name field value is used instead.
    Note

    In naming your intents, do not use system. as a prefix. system. is a namespace that's reserved for the intents that we provide. Because intents with this prefix are handled differently by Trainer Tm, using it may cause your intents to resolve in unexpected ways.
  5. Add an answer to the Answer field.
  6. In the Examples section, add training utterances that reflect typical ways that users would express the question that the intent is answering.

Create Answer Intents from a CSV File

You can create answer intents in bulk by importing a CSV file. This file is similar to the standard intent CSV file, but in addition to the query, topIntent, and conversationName columns, it also has the answer column:
query,topIntent,conversationName,answer
What are your hours?,StoreHours,Our Store Hours,"We're open from 9-5, Mondays-Thursdays or by appointment."
When are you open?,StoreHours,Our Store Hours,"We're open from 9-5, Mondays-Thursdays or by appointment."
When do you close?,StoreHours,Our Store Hours,"We're open from 9-5, Mondays-Thursdays or by appointment."
What do you sell?,Products,Our Products,We sell only hammers. All types.
Do you sell brick hammers?,Products,Our Products,We sell only hammers. All types.
Do you sell claw hammers?,Products,Our Products,We sell only hammers. All types.
Do you deliver?,Delivery_and_Pickup,Pickup and Delivery options,"No delivery service, sorry. Purchases are in-store only"
Can I buy one of your hammers on the web?,Delivery_and_Pickup,Pickup and Delivery options,"No delivery service, sorry. Purchases are in-store only"
Can you mail me a hammer?,Delivery_and_Pickup,Pickup and Delivery options,"No delivery service, sorry. Purchases are in-store only"
Can I return a hammer?,Returns,Our Return Policy,You cannot return any items. All sales are final.
My hammer doesn't work,Returns,Our Return Policy,You cannot return any items. All sales are final.
Can I exchange my hammer,Returns,Our Return Policy,You cannot return any items. All sales are final.

DO's and DON'Ts for Conversational Design

Creating a robust set of intents for a successful skill requires a lot of attention. Here are some best practices to keep in mind.

Intent Design and Training

DO DON'T
DO plan to add utterances until you get results you expect. Generally speaking, models perform well as you add more quality training utterances. The number of utterances you need depends on the model, the training data, and the level of accuracy that is realistic for your model. DON'T over-train individual intents. Don’t add excessive training data to some intents to make them work "perfectly". If intent resolution is not behaving as expected, evaluate your intent structure for overlap between intents. Intent resolution will NEVER be 100% accurate.
DO use real world data. Using the actual language that your skill is most likely to encounter is critical. Fabricated utterances can only take you so far and will not prepare your skill for real-world engagement. DON'T use just keywords in training data. While it is acceptable to use single words/short phrases for training, the training data should have the same structure as the user’s inputs. The fewer the words in utterances, the less successful classification will be.
DO use whole sentences to train intents. While it’s OK to use short training utterances, be sure to match the conversational style of your users as closely as possible. DON'T inadvertently skew intents. Be careful of words which add no specific meaning (e.g. "please" and "thanks") or entity values within utterances as they can inadvertently skew intent resolution if they are heavily used in one intent but not in another.
DO use similar numbers of utterances per intent. Some intents (e.g., "hello", "goodbye") may have fewer utterances in their training sets. However, ensure that your main intents have a similar number of utterances to avoid biasing your model. DON’T rely ONLY on intent resolution. Use entities to disambiguate common intents. If there’s linguistic overlap between intents, consider using entities to disambiguate the user’s intentions (and corresponding unique conversational path).
DO handle small talk. Users will make requests that are not relevant to the skill's purpose, such as for jokes and weather reports. They may also do things like ask if the skill is human. Ensure that you have a small talk strategy and aggressively test how the skill responds at all steps of your conversational flow. DON’T overuse unresolvedIntent. Create “out-of-scope" intents for the things you know you don't know (that you may or may not enable the skill to do later).
DO consider multiple intents for a single use case. Customers may express the same need in multiple ways, e.g. in terms of the solution they desire OR the symptom of their problem. Use multiple intents that all resolve to the same "answer". DON’T ignore abusive interactions. Similar to small talk, have a plan for abuse. This plan may need to include measures to ensure any abusive input from the user is not reflected back by the skill, as well as provisions for immediate escalation.

Conversational User Experience

DO DON'T
DO give indications of most likely responses (including help and exit). For example, "Hey, I'm Bob the Bot. Ask me about X, Y, or Z. If you run into any problems, just type 'help'." DON'T delay conversational design until "later in the project". For all but the simplest skills, conversational design must be given the same priority and urgency as other development work. It should start early and proceed in parallel with other tasks.
DO consider a personality for your bot. You should consider the personality and tone of your bot. However, be careful of overdoing human-like interaction (humor and sympathy often don't resonate well from a bot) and never try to fool your users into thinking that they are interacting with a human. DON'T say that the skill "is still learning". While well-intended, this bad practice signals to the user (consciously or subconsciously) that the skill is not up to the task.
DO guide the user on what is expected from them. The skill should try to guide the user toward an appropriate response and not leave questions open ended. Open-ended questions make the user more likely to fall off the happy path. DON'T use "cute" or "filler" responses. See "DO guide the user on what is expected from them".
DO break up long responses into individual chat bubbles and/or use line breaks. Large blobs of text without visual breaks are hard to read and can lead to confusion. DON'T say "I’m sorry, I don’t understand. Would you please rephrase your question?" This lazy error-handling approach is, more often than not, inaccurate. No matter how many times a user rephrases an out-of-scope question, the skill will NEVER have anything intelligent to say.
-- DON'T overuse "confirmation" phrases. Confirmation phrases have their place. However, don’t overuse them. Consider dialog flows that are able to take confidence levels into account before asking users to confirm.

Test Strategies

DO DON'T
DO develop utterances cyclically. Developing a robust training corpus requires multiple iterations and testing cycles and ongoing monitoring and tuning. Use a cyclical "build, test, deploy, monitor, update" approach. DON'T neglect the need for a performance measurement and improvement plan. Lacking a plan for measuring and improving your skill, you'll have no way of knowing whether it’s really working.
DO test utterances using the 80/20 rule. Always test the robustness of your intents against one another by conducting multiple 80/20 tests, where 80% of newly harvested utterances are used to train the model and 20% are added to your testing data. DON'T test only the happy path. "Getting it working" is 20% of the work. The remaining 80% is testing and adjusting how the skill responds to incorrect input and user actions.
DO test skill failure. Aggressively try to break your skill to see what happens. Don’t rely solely on positive testing. DON'T ignore processing out of order messages. Users will scroll back in conversation history and click on past buttons. Testing the results need to be part of your 80% work (as noted in DON'T test only the happy path).
-- DON’T forget to re-test as you update your intents. If you add more training data (e.g., as you bot gets more real-world usage) and/or you add new intents for new use cases, don’t forget to retest your model.

Project Considerations

DO DON'T
DO select use cases that are enhanced by conversational UI (CUI). Enabling conversational UI (via skills and digital assistants) is work. Make sure that the use case will be truly enhanced by adding CUI. DON'T fail to have an escalation path. Even if you don’t plan on allowing escalation to a human, you must have a strategy for those interactions where the skill can’t help.
DO anticipate the first day being the worst day. Even the best-tested skills and digital assistants require tuning on day 1. DON'T disband the project team immediately after launch. When scheduling your skill project, ensure that you keep the skill’s creators (Conversational Designer, Project Manager, Tech Lead, etc.) on the project long enough for adequate tuning and, ultimately, knowledge transfer.

Names You Can't Use for Intents

Intent names can not start with system. ("system" followed by ".").

Note

The Automated Agent Assistant has several such intents, but they are treated as a special case and should not be used elsewhere.