The course is part of these learning paths
This course is the first in a two-part series that explores how to create a chatbot using Google Dialogflow. We'll take an introductory look at what the Google Dialogflow tool is used for and look at the basic steps and components required to make a chatbot. We'll cover the concepts and technical aspects to consider when building a chatbot, and then put these into context by applying them to a real-world scenario.
- Understand the fundamentals of creating chatbots using Dialogflow
- Learn how chatbots interact with users
- Understand the technical aspects of developing a Dialogflow application
- Learn how the concepts covered in the course can be applied to a real-world scenario
- Anyone looking to build chatbots using Google Dialogflow
In order to get the most out of this course, you should have at least a basic understanding of:
- Computer science techniques
- REST APIs and SQL
- Google Cloud Platform
So to get right into it. Let's talk about how and why you would want to use a chatbot like Dialogflow. Frankly, there's a lot of different technologies out there. What's so special about what Google has done and how does it integrate with other Google technologies in order to help you bring your human interactive solution to market faster.
So in getting started, it's very important to understand that human language and machine language is extraordinarily different. You don't go to your friend and say select, what time is dinner, from table, mealtimes. That's just not how people talk. You say, Hey, what time is dinner going to be? It's critical that a chatbot or anything that converses with humans, especially if it's generalized to the broad set of people and not just engineers. That it needs to have the ability to understand what people say in a method that people talk naturally.
Basically, can the chatbot determine what a person is trying to tell it? A key is the intent, which is a key we'll be coming back to, the intent in a message when somebody is attempting to communicate with it. So in this example, the intent is that a person is attempting to query the time that dinner occurs.
Another keyword is parameter, and that is that the meal is dinner and that the time is today. So we're going to use these parameters and intents and go to our data repository and look it up now.
Dialogflow is phenomenal at helping you parse that out but it also handles a few other things. It handles things such as multi-stage conversations and extracting entities for parameterization. And it's also important to understand that Dialogflow does more than simply interpreting what a person says. It actually has the ability to pull it all together and help people ask better questions.
So how often have you had to ask somebody, What, I didn't hear you, can you repeat that? Or what do you mean? And frankly, people ask bad questions all the time. So imagine someone wasn't paying attention and they say what time is the next? That doesn't make sense next what? Meal? Next train arriving? Dialogflow helps you manage people's interaction. And not just any interaction, especially understanding when people are interacting with the chatbot that might not be trained. This might just be somebody such as a random person using a bank and concierge bot that isn't run of the mill person using their checking account.
The programmers, and I don't wanna use the word defensively because it sounds like you versus your end user but it helps you program something that is more error proof and handle a lot more fuzziness that comes when random people or broad general public talk to it.
So Dialogflow takes all of this human fuzziness and turns it into a machine-readable API. Basically, Dialogflow is going to make an outgoing post request or interact with the Google cloud function. And what we've done is turned a potentially imperfect human conversation into a series of easily understandable API databases and look-ups.
So in this previous example of what time is dinner, Dialogflow would be able to understand something that the intent mealtime, look up meal dinner and bundle that into an API call that goes to the backend where we can build a rather straightforward fulfillment service. And before we move on, Dialogflow supports many languages beyond just English. So regardless of what nationality or geographic region you're trying to cover there's a good chance that you have a language that is well understood or at least commonly used in that area.
So there's a couple of key terms that I've been using and just sprinkling in. And as I give my initial introduction it's important to understand how they fit together because these terms are critical to understand the architecture, the flow and the development of a successful Dialogflow chatbot.
Frankly, the highest level is agent. This is a collection of business features. It's basically a bundle of functionality that someone would expect from it. So a bank might have an agent that handles all incoming customer concierge related issues. Alternatively, the bank might have another agent that handles internal FAQ questions for employees.
So at a high level, an agent handles everything that you would expect from a bot. Whereas if you open up a conversation with this agent, it should be able to reasonably help you answer the requests you would expect from a conversation. But to bring it back to a slightly less abstract sense is intents intents when an agent is attempting to detect from a user and what the intent they want from the service.
So when they're talking to a chatbot somebody clearly wants something. Nobody is just going to call the chatbot for no reason. So for example, a user might ask a banking chatbot what is my balance today? And the intent would be something like, get balance. Intents are important because they represent an underlying function that your backend will have to fulfill or answer on. And these need to be clearly differentiated.
So we need to be able to tell what intent a person wants before we can move forward. Really, so when a person starts asking what is the balance of my banking account, we need to understand that they're not looking to transfer money or maybe increase their bank account balance or they're not looking to start overdraft protection. They want a very specific piece of information and a very specific query flow. And that's where Dialogflow shines and is able to pull intents out of an otherwise fuzzy situation.
But in order to keep intents separate and not have an endless number of intents we also have the concept of entities. Entities are things that could be a parameter within an intent. So the nuance here is that intents are a specific call to action and the intent can have parameters and those parameters are typically entities.
So take the query, What is my bank account balance of my checking account. The intent is get balance and the parameter in which an entity is slotted into would be checking account. And once the agent has determined a user's intent, parameters and slot filled those parameters with entities we need to fulfill the message. Basically, we need to calculate a response that says, Hey your bank account balance is $400.
So fulfillment is really catchall phrase, that covers a fulfillment service, which may be a database lookup or anything on the backend that is responsible to handle a user's request. But there's also integrations. Integrations are key within Dialogflow. A chatbot is nothing, if you can't talk to it.
So there's more than 22 native integrations for Dialogflow. And frankly, you can expand it quite a bit through client libraries, but what you can do to interact with Dialogflow is look at a lot of different end points that people can use not just machines. This is things like Slack, Twitter, text messages, Twilio, built in bubbles that pop up on your website and all of the ones that people can both send in requests and get requests through hardware and software packages that have a good human machine interface.
And finally, this one really isn't as important to everybody but the knowledge, data features that Dialogflow has is basically the ability to do a rapid development FAQ service that will cover existing knowledge basis. And we'll just briefly discuss this on the end. You don't have to worry about this quite as much.
So really the keys that you need to understand are the relationship of agents, intents, entities, fulfillment and integrations. I find it extremely useful to put it in a diagram like this. This diagram from the top down kind of highlights how you should think about Dialogflow in your mental model. And frankly, if your company still meets in person to whiteboard and you're not all work from home, this is a good way to draw out what you're trying to build.
So at the highest level, there's a collection of functions the business level functions and that's a concierge banking agent in this example. So this agent will have a collection of intents. These intents are things such as check bank account balance or change mailing address. These are what a user wants to get out of the agent and the whole reason they're going to even interact with the service. And within these intents are parameters which of course are entities. And these entities could be either mandatory things such as account number, date of balance, or actually they could also be optional things such as date of balance.
So if a user goes up to the bank and concierge bot and says, Hey what is the bank account balance of my checking account? I could assume they meant today because that's an optional parameter. But if I don't say checking account, Dialogflow could engage in its multi-step conversation and say, Hey what do you mean?
So when you're thinking about how to put Dialogflow together and its architecture, think of it like this as your base understanding. All of this would be underscored by fulfillment because once somebody understands the intents and entities, it has to make an API call to an underlying fulfillment service.
Frankly, this is the mental model that we use and whiteboard out. And if you're able to do this you'll be able to build a really rock solid bot. So when taking all of this into account, remember that Dialogflow has a great graphical user interface. And this architecture and hierarchy of elements is reflected here on the left-hand side. You can literally see it goes intents, entities, and fulfillment within the broader agent which is the dropdown arrow at the top.
So this is really how you can start thinking about things. And not only is it a good abstract model it's a good practical model when it comes time to actually program it. Now beyond just the GUI. Let's look back on the question. What is natural language understanding? Basically, this is what Dialogflow utilizes in its broader effort to understand what somebody is meaning beyond just natural language processing.
Natural language understanding is a subset of natural language processing that focus is on key issues such as what is the action or actionable information? What are the entities in the statement and how does it all fit together?
As you just saw, this is extremely useful 'cause we can use this to determine the intent and parameters of a statement. And when building out a chatbot, it allows you to translate what people are saying, take it into context and actually build a response. It's actually very important for us to understand the context. And this is key because when doing natural language understanding, understanding if you call somebody a monster versus the monster energy drink brand it's an extremely important nuance that you understand what somebody is referring to.
If you're building something that helps people go shopping online and they search for monster energy drink and you pull up styles of Halloween monsters like Frankenstein, that's not really a good user experience. So you need to understand, is that the energy drink is it a monster somebody's looking to spook somebody with? Or how are they related? This also is key with brands that share common words such as, are you looking for Google or are you looking to Google something? Are you looking up information about the company or these using it as a verb? So being able to control this is key.
So to recap, what is Dialogflow and why should we use it? At core, it's a simplified way of creating a chatbot that converses in human native language. That human native language doesn't mean things such as English or Chinese or Spanish. What it means is in a way that people talk naturally. And then we're able to take this natural conversation flow and interpret it and serve it back to something that is an understood intent and fulfilled with a machine response.
Calculated Systems was founded by experts in Hadoop, Google Cloud and AWS. Calculated Systems enables code-free capture, mapping and transformation of data in the cloud based on Apache NiFi, an open source project originally developed within the NSA. Calculated Systems accelerates time to market for new innovations while maintaining data integrity. With cloud automation tools, deep industry expertise, and experience productionalizing workloads development cycles are cut down to a fraction of their normal time. The ability to quickly develop large scale data ingestion and processing decreases the risk companies face in long development cycles. Calculated Systems is one of the industry leaders in Big Data transformation and education of these complex technologies.