Hi. Welcome to next part of RB system.
If you don't know RB system then check before post here.
In this part. We will step by step build stories in coffee shop for order function and realtime testing.
What is stories? Stories are small communication between human and human, human and BOT.
Below is communication sample in coffee shop
Customer: Hello
Staff: Hi. What would you like to drink?
Customer: I want a cup coffee
Staff: Ok. Would you like more or less sugar?
Customer: more
Staff: Yes. A cup coffee more sugar
We build a RB on Dialogflow and training to my RB can understand and response each request.
I. BUILD STORIES WITH SIMPLE INTENT
Step 1. Go to Dialogflow homepage and register new account.
Step 2. Go to console in dialogflow and create new bot.
Step 3. Set name and link RB to google project. This is importance, each bot in Dialogflow direct link to each google project for using service in google project (google assistant, ..). If select "create new google project" then new google project will create link to gmail account registered.
Step 4. After bot created, you have 2 intent default:
- Default Fallback Intent: intent will called when you say anything not match intent available.
- Default Welcome Intent: handle for welcome sentence
Try input anything in voice box and hit enter.
Some information display same above picture.
"Can you say that again?" this is response from bot. It's define in Default Fallback Intent because text you enter not match anything intent.
Hit "SHOW JSON" to view response from bot in Json format.
Step 5. We create new Intent by hit plus at right of Intents menu. Enter name for intent "Ask Promotion". We will create ask promotion intent for handler question of customer.
Hit "Add Training Phrases" to add pattern we guess. Think some sentence customer can ask:
- What promotions today?
- Hi shop. Have any promotions today?
- Have promotions for VIP members?
- Have promotions discount?
We can see that "promotions" always exist in sentence but each another meaning. So we need group sentences same meaning.
Group 1: ask any promotions
- What promotions today?
- Hi shop. Have any promotions today?
Group 2: ask only promotions for VIP member
- Have promotions for VIP members?
Group 3: ask only promitions discount
- Have promotions discount?
Each group we will build another intent. Starting build intent for group 1, we should rename intent "Ask Promotion" to "Ask any promotion". Enter full sentences in group 1 to Training Phrases. This pattern will compare when customer saying.
Hit "Add Responses" and enter some response you want response when this intent matched.
Hit "Save" to save to training bot.
Step 6. Testing new intent. Enter sentence in textbox "What promotions today?" and hit enter. What you see? In default response session display sentence you define in before step. If you define more than 1 response then your system will random display. End this step, you can define more intent for group 2 and 3.
Next, try enter "promotions today?" and hit enter. What you see? Bot still recognizes correct Ask any promotion intent. This is ai of dialogflow, help build small pattern but recognizes and handler big request from user.
II. BUILD STORIES COMBINE INTENT AND ENTITY
In this part 1, we have build intent from sentence which we guess. But if intent relative more options then we need build sentence for each options.
Example customer ask staff:
- Does sell the capuchino?
- Does sell the coffee?
- Does sell the mocha?
Step 1. When product name in sentence is more options, we define this options is entity. Hit plus in Entities tab for add new entity.
Enter name for entity is "drink" and enter drink name into entry box. Each entry box is each product name. Each product can more name example: capuchino, hot capuchino, cream capuchino, .. we enter all name into entry box and separate by tab.
Step 2. Create new intent with name "Ask product"
In Training Phase session click to (") to change to (@). This is mode for entities references.
Enter "Does sell the @drink:drink_entity ?"
- @drink: reference to drink entity.
- drink_entity: anything name define param name response from dialogflow (Json format)
Enter response text and hit save.
Step 3. Testing with sentence "does sell the capuchino". What you see?
In PARAMETER session display drink_entity is capuchino. End step, you can knowledge dialogflow and build intent in dialogflow.
Try another product you not define and see. Bot not found drink_entity.
III. CHAT BOT TESTING
Dialogflow support more testing method. In which the easiest way is Web Demo. Hit to Integrations in left menu and turn on Web Demo. After, click to link in dialog for start testing.
At this point. You can chat with your bot realtime.
In next part. We starting connect bot to webhook for realbot.
To view previous part, click here.
0 on: "Receptionist Bot (RB) using dialogflow - Part 2 (build stories)"