Train with Stories and Rules

StoriesClosed Used to train bot for interaction handling based on intent and context and rulesClosed Used to define bot's response to messages that don't change with context. are powerful training tools. You can use them to teach your bot how to choose the best response based on entities or slot values.

Train a Bot Based on Entities

Your bot needs to be able to recognize variations of an intentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish. Intent variations occur when one intent has more than one possible match in what the contact Closed The person interacting with an agent, IVR, or bot in your contact center.might say. For example, a balance_checks intent might have variations for account type, such as savings, checking, investment, or gift cards. You can train your bot to recognize intent variations. This allows your bot to be more specific in addressing contacts' needs. It also helps your bot avoid intent confusion.

When a contact wants to check their balance, they might say "I want my savings balance" or "Can you give me my checking account balance?" If your bot will respond the same for every account type, you don't need to train the bot on these variations. However, if your bot needs to take different actions based on account type, you do need to train on variations. For example, checking the balance of a savings account requires contact ID verification, while checking a gift card balance does not.

Training on intent variations requires that you identify the entity that will determine the path the bot takes. In the account balance example, the entity is the one that holds the account type, such as AccountType. The entity extracts the account type and stores it in the corresponding AccountType slot. The bot evaluates the value in the slot to determine which path to take.

The following table shows one approach to handling intent variations with stories. It may help to create a similar table for the use cases you want to create.

Intent Details Story Name Contact Message Example
Baseline Story This is the story without any entities. The path for this story will include the bot asking for clarification. Check_Balance "I want to check my account balance. "

Story +[Entity]

Versions of the baseline story that include an entity to provide context.

Check_Balance+Savings

Check_Balance+Checking

Check_Balance+Invest

Check_Balance+GiftCard

"What is my savings account balance?"

"What is my checking account balance?"

"What is my investment account balance?"

"What's the balance on my gift card?"

  1. In CXone, click the app selector and select Bot Builder.

  2. Click the bot you want to work with.
  3. Create an entity for the variations in the intent you're working with, if you haven't done so already. Add appropriate examples. For example, for an AccountType entity, add the types of accounts the bot can check.
  4. Click the Stories or Rules tab.
  5. Configure the slotClosed Entity extracted from contact's message and saved for use in bot responses. Similar to a variable. that was automatically created when you created the entity. Make the following changes to the slot:

    • Select Categorical as the Type.
    • Enable Influence Dialogue.
    • Enter the Values that the slot will hold. These are the entity values you're training your bot to recognize. For an AccountType slot, the values might be checking, savings, gift card.

  6. Create a baseline story or rule, or modify an existing story or rule. When working on the baseline dialogue: 
    • The dialogue's name should convey the intent it's related to, but be generic enough that you can add on to it when you create stories for the variations. Following the balance check example, Check_Balance is a good name for the baseline story. It can easily be added onto.
    • The contact message A green rectangle with a face inside. that begins the story should be a generic utterance that triggers the intent but doesn't specify an entity. For example, "What's my account balance?"
    • Ensure that the predicted intent is correct. If it's not, add more intent examples.
    • The bot's response should be appropriate for your use case. For the balance checking use case, the bot asks the contact for clarification about which version of the intent they want, such as "Okay, which account should I check?" You could include buttons or quick replies to prompt the contact to select an option.
  7. Create or modify a story for each of the variations. For each story: 
    • Name it to clearly identify the variation it trains on. For example, Check_Balance + Checking.
    • Add a contact message A green rectangle with a face inside. that will trigger the correct intent. The message should include the entity that matches the variation. For example, the message I need my checking account balance contains an example of the accountType entity. Click the arrow to send Icon of an triangular arrow head pointing right. the message, but don't click Confirm yet.
    • Ensure that the predicted intent is correct. If it's not, add more intent examples.
    • In the message bubble for the contact message, click the entity and select either Lookup Three stacked horizontal lines. or RegEx A small dot and a larger asterisk *. as the type of entity. This adds the selected entity's slot to the message filled with the selected value. The filled slot acts as a condition for the bot to follow this story's path.

    • Design the bot's response to handle the contact's needs for this intent variation.
  8. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.
  9. Test this set of stories by chatting with your bot. When testing, run through at least one test for each possible path to ensure that the bot responds appropriately.

  10. If necessary, make changes to your training stories to fine-tune the bot's performance. You may need to add more intent examples or entity examples. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.  Repeat the testing and adjusting process as often as necessary.

Train a Bot Based on Slot Conditions

You can use the slot condition bot action to train your bot to use different responses based on the value the slot holds. When you include this bot action in a bot response, the value of the specified slot becomes a condition that determines which path the bot takes.

You must create a storyClosed Used to train bot for interaction handling based on intent and context or ruleClosed Used to define bot's response to messages that don't change with context. for each possible path, as well as one for an out-of-scope path. For example, if there are three possible values the slot could hold, you need a dialogue for each one. You also need a fourth dialogue for any values that are outside of the three that you expect. All dialogues use the same intentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish and have a slot condition bot action, which is set to a different slot value in each dialogue. After the slot condition bot action, the dialogues are all different according to their unique to path variations.

When the bot is well-trained on a set of conditional dialogues, it knows that when it identifies an intent with conditional paths, it needs to evaluate for which path to take. It compares the current value of the slot and takes the path defined in the dialogue with the matching value.

Training with slot conditions achieves a similar result to training with entities. Training with entities requires you to use entity-based slots. However, using slot conditions allows you to use slots that fill from other sources as conditions in your stories.

Before you begin, plan the conversation paths that this slot condition creates, using the following table as an example. This example shows the stories for when the bot asks contacts if they want to subscribe to a newsletter. The contact will say either yes or no, and the bot responds accordingly.

Intent Details Story Name
Story + [Path 1] This is the story with one of the possible slot values. Subscribe_Yes

Story +[Path 2]

A version of the first story that covers the other possible response.

Subscribe_No

  1. In CXone, click the app selector and select Bot Builder.

  2. Click the bot you want to work with.
  3. Click Dialogues icon, which looks like conversation bubbles. in the left icon menu.
  4. Click the Stories tab.

  5. Create the slot that you are going to use to branch the conversation, if you haven't done so yet. Make the following configurations for the slot:

    • Select Categorical as the Type.
    • Enable Influence Dialogue.
    • Enter the Values that the slot will hold. These are the entity values you're training your bot to recognize. 
  6. Ensure that the slot is filled appropriately during the conversation prior to the set of stories you will be creating to branch the conversation.
  7. Create a story for each possible slot value: 
    • The story's name should have two parts. One should refer to the overall intent at the time when the conversation branches. The second part should indicate the specific branch the story addresses.

      For example, if the conversation branches when the contact is asked to subscribe to a newsletter, the story names could be Subscribe + No and Subscribe + Yes.

    • The contact message A green rectangle with a face inside. that begins the story can be the same for every version of the story or it can be different. What you need will depend on the specific use case you're working with.
    • The bot's response should contain the slot condition bot action. Configure this action with: 
      • Choose the Slot that determines the branching of this story.
      • Enter the Value that the specified slot must hold for the bot to continue following the path described by this story.
  8. Create a story for the out-of-scope path taken for any values other than the ones configured in the slot's Values field: 
    • Ensure that its name follows the pattern established with the first story, but makes clear it's out of scope. For example, Subscribe + Other.
    • Enter a unique Value. If two stories share the same value, the bot won't know which path to follow.
  9. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.
  10. Test this set of stories by talking to your bot. When testing, run through at least one test for each possible path to ensure that the bot responds appropriately.

  11. If necessary, make changes to your training stories to fine-tune the bot's performance. You may need to add more intent examples or entity examples. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.  Repeat the testing and adjusting process as often as necessary.

Train a Bot Based on Rule Conditions

You can specify conditions for rules. The conditions define when the bot should use a particular rule. This is helpful if you want your bot's response to be different in certain circumstances. The conditions you can set are based on:

  • The active form: You can choose a form that must be active for the bot to use the rule.
  • A slot value: You can choose one or more slots and specify a value for each one. The defined slots must hold values that match what you specify for the bot to use the rule.

When you use rule conditions: 

  • You can use form and slot value conditions together in the same rule.
  • You can have a single rule with conditions. This is helpful if you only want the bot to respond to the intent in the rule in one situation.
  • You can have sets of rules with similar conditions with different stated values. This is helpful if you want the bot to respond in different ways to the rule's intent based on the slot values.

Rule conditions based on slot value are not the same as slot condition bot actions. Rule conditions define when the bot follows a rule. The slot condition bot action defines a condition for branching the conversation while the bot is executing the rule.

  1. In CXone, click the app selector and select Bot Builder.

  2. Click the bot you want to work with.
  3. Create the form you are going to use as a rule condition, if you haven't done so yet.
  4. Create the slot that you are going to use as a rule condition, if you haven't done so yet. Make the following configurations for the slot:

    • Select Categorical as the Type.
    • Enable Influence Dialogue.
    • Enter the Values that the slot will hold. These are the entity values you're training your bot to recognize. 
  5. Click Dialogues icon, which looks like conversation bubbles. in the left icon menu.
  6. Click the Rules tab.

  7. Click Add condition at the top of the middle pane.
  8. Select either Active Form or Slot Value and configure the options that appear: 
    • Active Form: Click the Select Form(s) drop-down and choose the form that must be active.
    • Slot Value: Click the Select Slot drop-down and choose a slot, then enter a value field on the right. This is the value the slot must hold for the bot to use this rule.
  9. Add more conditions as needed. You can only have one active form condition in a rule, but you can add multiple slots as conditions.
  10. Add a contact utterance and bot response to the rule.
  11. Repeat these steps to create additional rules with different values, if you want the bot to respond differently for other values the configured slots might hold. Additional rules should have the same intent as the one you just created.
  12. Create a rule with the same intent but no conditions if you want a default version of the rule for the bot to follow when none of the conditions match.
  13. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.
  14. Test this set of rules by talking to your bot. When testing, run through at least one test for each possible path to ensure that the bot responds appropriately.

  15. If necessary, make changes to your training stories to fine-tune the bot's performance. You may need to add more intent examples or entity examples. When you're finished making changes, click Train and Stage to update your bot modelClosed Version of a bot that has been trained and staged to test this change.  Repeat the testing and adjusting process as often as necessary.