In part one of this series, we looked at creating our first Dialogflow Agent. Now, in part 2, it's time to get our agent working for us by setting up a basic 'Intent' and taking a first look at how Dialogflow's machine learning can save us time and make predictions user responses so much easier.
July 7th, 2018—This tutorial is growing. Be warned that as of now, it's incomplete. Don't throw things when you get to the part you need and it's not yet there. I'll be adding the additional Parts over the coming 2 weeks. At the end of a part, if that's where we drop out, we'll note what's beign written next.
Goals:
- Understand Intent
- Sketch out training phrases
- Set-up first intent and training phrases
- Sketch out responses
- Test and first peek at machine learning benefits
Understand Intent
Intent is where the good stuff starts to happen. In our ever hopeless quest to keep things as simple as possible, it helps to think of 'Intents' as compartmentalized lists of things that:
- You think your user might say to try to accomplish something
- Instructions that tell Dialogflow what to do if the user's request matches—or thanks to Dialogflow's machine learning, comes close to matching—what you defined
Here's Dialogflow's definition in the docs
The bot we're creating in this tutorial is for an imaginary real estate agent who wants to answer questions about a specific community called "Mountain House". To start creating intents, we need to think about the categories of questions users may have:
- Schools
- Community Services
- Utilities
- Taxes
- Community Activities
- etc...
It's likely, depending on your own bot's logic and flow, that you'll create an intent for each category and possibly subcategory. To see what that looks like in practice, we'll first need to sketch out some 'Training Phrases' that we will then bring into our first Intent.
Sketch out training phrases
'Training Phrases' are just predictions we make regarding questions a user may ask when trying to accomplish something with our bot.
Using the category 'Schools' from above, as an example, we would want to sketch out a list of questions, statements, and phrases one may use if trying to find information on schools within Mountain House.
- What schools are nearby?
- Are there good schools?
- List of schools
- Can you tell me what schools are in the community?
- What schools are in Mountain House?
- How many schools are in Mountain House?
- etc...
Now that we have our list sketched out we'll log back into Dialogflow and begin plugging them into a "Schools Intent".
Before we do that, it's worth taking a timeout to say, this tutorial says nothing about how chatbots should be designed. We're designing, or rather not designing at all, this chatbot to fit within a brief tutorial. With that in mind, we'll be taking a lot of shortcuts that you wouldn't want to take within your own project.
Now, back to Dialogflow and making our bot smart...and stuff.
Set-up first intent and training phrases
1. Smash the 'Create Intent' button
2. Give that beautiful intent a name (ours is 'Schools')
3. Click on 'Add Training Phrases'
4. Plug in your training phrases
5. Click 'Save'
Now that we've set up our 'Schools Intent' to tell Dialogflow what to watch for, we need to tell it how to respond to a request that maps to one of our training phrases.
Sketch out Responses
Although in later parts of this series we'll be showing how one can pull 'Responses' from a Firebase database, for now, we're going to put our Responses directly into our Intent after sketching them out.
To make our bot feel more human, we'll want to create a variety of responses:
- There are 7 fantastic schools in Mountain House. Their names are...
- Mountain House has some of the best schools in the area. The list is...
- Yup! Mountain House is known for its schools. Here's a list...
Now let's plug them into our Intent.
1. Click on 'Add Response'
2. Add in the responses you sketched out
3. Save
Easy enough. Now our intent is ready to test
Test and first peek at machine learning benefits
Luckily, Dialogflow makes it really easy for us to test. We can test directly in the console by using text or voice in the upper right-hand section of the console:
If you noticed, we not only wrote a question that isn't one of our "Training Responses" but also misspelled "there":
This is where the power of Dialogflow's machine learning start's to kick in. We can see that it was smart enough to understand that the request's intent was related to our "Schools Intent" and then served up one of the Responses we wrote in above.
Dialogflow won't work magic but it does a pretty good job of guessing when users express queries that have similar intent to what we listed in our training phrases.
The better you are at sketching out appropriate Training Responses, the better you set yourself up for Dialogflow to catch what you couldn't predict.
Start thinking about what Intents you would need to capture your own user requests, sketch out a list of possible training phrases and subsequent responses and then be methodical with your tests to see what's missing.
✅ @cinderhouse, I gave you an upvote on your post! Please give me a follow and I will give you a follow in return and possible future votes!
Thank you in advance!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @cinderhouse! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Quarter Finals - Day 2
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit