In this tutorial, you take things to the next level. Instead of using patterns to trigger a dialog, you use an intent.
Watch the video - Intents & entities
Watch the video - Advanced interactions
Step 5: Create a Billing intent
Since you’re going to be using an intent in this tutorial, you need to leave the Conversation Builder application for a moment.
In the upper-left corner, click < Back twice. This returns you to the Conversational AI dashboard.
Click Intent Builder.
Intent Builder is where you create domains, which are collections of intents and entities. You can learn about Intent Builder here.
Now let’s create a domain.
In the upper-right corner, click Add Domain.
On the Add Domain page, on the New Domain tab, give your domain a name (e.g., "Getting Started Domain"), select "Manual", and click Add. (While you will manually add intents and entities, they can be imported from a CSV file too.)
This displays the Add Intent page. Now you can begin to create an intent.
Enter "Billing Question" for the Intent Name.
- In the Training section, add the following training phrases, pressing Enter to add each one:
- i have a question about my bill
- can you help me with my bill
- i have a bill related question
- my bill is past due
- I am looking for my most recent bill
Using the word “bill” in the training phrases is important because you will create an entity named "bill" that the phrases will recognize.
Click Save in the lower-right corner.
Now you can use the debugger to test how the training phrases match against a user's utterance.
In the Test User Input panel on the right, enter an utterance that is close to one of your sentences, like, "I need help with my bill". Then click Test.
Test another utterance but use “billing” instead of “bill”, e.g., "I have a billing question".
The result when using "billing" is only FAIR because it is not recognized as a synonym for “bill.” You can remedy this by creating an entity. You do this next.
In the upper-left corner, click Entities.
On the Add Entity page, create a new entity named "BILL," keeping the default value of "Value Set" for the Entity Type. Add a number of entity values (synonyms) like
statement. Press Enter to add each one.
It is recommended that you use a unique naming convention when creating your entity name. This allows them to be easily identified in your training phrases. Commonly used conventions at LivePerson are all caps (e.g., BILL) or preceding with an "ent_" prefix (e.g., ent_bill).
Click Save in the lower-right corner.
Now let's see how adding an entity can improve the NLU matching.
Click Intents in the upper-left corner to return to the Intents tab, select the "Billing Question" intent (if necessary), and use the debugger again. This time re-enter the phrase, "I have a billing question".
Now the result is VERY GOOD, and you can see that the entity @BILL was detected.
Step 6: Link the intent to a Billing dialog
With the "Billing Question" intent configured, let’s return to Conversation Builder and use the intent to trigger a new dialog.
- In the upper-left corner, click < Back twice to return to the Conversational AI dashboard.
- Click Conversation Builder.
- Select the bot you previously created.
Create a new regular dialog named "Billing Question".
By default, a regular dialog includes a Dialog Starter interaction, but it isn't configured yet. You'll use the Assist tool to do this.
- Open the Assist tool by clicking (Assist icon) beside the Dialog Starter interaction.
In Assist, search for the name of the domain that you created (e.g., Getting Started Domain).
Select the domain to associate it with the dialog starter.
In Assist, the intents within the domain are displayed. Type in a sample user message to use the NLU engine to identify the correct intent.
Select the "Billing question" intent that you created. This associates the intent with the dialog starter.
Step 7: Add custom rules
Now you can begin to build out the Billing dialog.
- Add a Text statement that says, “Sure, I can help with that."
Add a Multiple Choice question that asks, "Would you like a copy of your most recent bill?" Enter "Yes" and "No" as the choices.
When someone says "yes," you'll want to show them a specific message. The same applies when someone says, "no."
Add a Text statement to respond to a reply of "yes". Name the interaction "Yes" in the upper-left corner. For the statement's text, enter, "If you would like the most recent copy of your bill, go to http://example.com.” Select "End Interaction" as the Next Action. Click the Save icon in the interaction's upper-right corner.
You make the last change because the default behavior for statements is to display the next interaction. In our example, the No statement will be next. Since the dialog flow should stop after the Yes statement, the Yes statement's next action should be to end.
Add a Text statement to respond to a reply of "no". Name the interaction "No statement" (in the upper-left corner). For the statement's text, enter, “Ok, how else can I help you?" Click Save.
You've got the dialog fleshed out; now you need to add custom rules to detect when a user says "yes" or “no” and direct them to the correct text statement.
Return to the multiple choice question, and select the Next Action dropdown.
- Add a rule to handle a "yes" response: Click + Custom Rule in the Next Action dropdown. In the Add Next Action Rule window, configure the Yes rule as follows:
- Rule name: Enter "Yes".
- Condition: Click + Add Condition. Select "Pattern" from the drop-down list of match types, and enter "yes" and "y" as patterns.
- And Go To: Select the "Yes" statement as the next action.
- Add a rule to handle a "no" response: Click the + Custom Rule button that's displayed once you have at least one rule defined. In the Next Action Rule window, configure the No rule as follows:
- Rule name: Enter "No".
- Condition: Click + Add Condition. Select "Pattern" from the drop-down list of match types, and enter "no" and "n" as patterns.
- And Go To: Select the "No" statement as the next action.
The multiple choice question should now look like this:
Now let's see the dialog in action.
- Open the Preview window, and start a new session by clicking Reset Session.
Enter an utterance that should match the billing intent, like, "I have a question about my bill." You should see the billing dialog's flow and the multiple choice question. Tap or enter “Yes” or “No” and see what response you get.
You now understand the basics of intents, entities, and branching dialog flows.
Continue on to the next tutorial in the series.