Get Started With Dialogflow - Part 1

Prem PawarPrem Pawar
4 min read

Before getting into the basics let's understand what is DialogFlow.

So DialogFlow is Natural Language Understanding Platform(NLP) owned by Google. DialogFlow Platform makes it easy to design and integrate and conversational user interface into your Interactive Voice Responses(IVR) systems, web apps, mobile applications, and so on. DialogFlow is based on google's own cloud platform.

DialogFlow comes with google's machine learning expert algorithms and speech-to-text features of google cloud. By using this platform developers can design conversational-based and text-based interfaces to solve the queries of customers in multiple languages.

Google offers DialogFlow in two different editions -

  1. DialogFlow ES (standard version)

  2. DialogFlow CX (advanced version)

For understanding the basics, we are mainly focusing on the ES edition of Dialogflow. In this part 1 of the article we are understanding the Agent, Intent, Entities, and Context.

Agent

A DialogFlow agent is nothing but a virtual agent which handles and manages end-to-end concurrent conversations. An agent is a module that understands the complexities and nuances of human language. In simple words, this agent is like a human call center agent which is trained to handle the conversations.

When you logged in to the Dialogflow console, you will see a button in the left upper corner 'Create Agent'. After clicking on 'Create Agent' you can enter your agent name and click on create. So once you create an agent, you are ready to start building.

Create a agent Google DialogFlow

Intent

Once you create an agent, you can start with creating the intents for your agent. Intents are basically the intentions of the end-user for one conversation turn. At the time of conversation, when the end-user says or writes something which is denoted as an end-user expression, then the Dialogflow checks and matches the end-user expression to your agent's best intent. Intent matching is also called Intent Classification.

Let's say, You created an agent for ordering a pizza. And you have different intentions for your conversation. For example, you have welcome intent, pizza intent, calculate bill intent, etc intents. So If the end user uses a pizza order agent, and says 'I wanted to order pizza', your agent is smart enough to use the welcome intent and not any other intent to give a response to the end user.

In each intent, you can add training multiple phrases and responses and the agent will automatically train the module in the backend. Based on the end user input, the agent will pick up the best suitable response to the user.

Entities

When you build the intent in Dialogflow, sometimes you need to extract some information from the input provided by the end user. There is a type for every intent parameter, which is known as an Entity type. Entity dictates exactly how from an end user input is extracted.

Dialogflow provides predefined system entities that can match many common types of data. for example, there are system entities for matching the dates, times, colors, numbers, emails, and so on. You can create your own custom entities also matching custom types of data.

Custom entities | Dialogflow ES | Google Cloud

Let's understand more with the example. If you wanted to make an agent bot for accepting pizza orders. So you need to take the input data from the end users like pizza type, size, toppings, etc. if the end-user says, "I want two large pizzas with olive toppings". So in this example, you are required to extract the number of pizzas ordered, the size of the pizza, and the toppings on the pizza. This you can make by creating custom entities. You can create three different entities called pizzaSize, pizzaCount, pizzaToppings, etc(you can create with any names). After creating an entity you can map this entity in intent training phrases. By looking at the below image you can understand how to use an entity in intent.

Training phrases | Dialogflow ES | Google Cloud

Context

DialogFlow context is similar to natural language context. In Dialogflow, to handle the context of the user input, the Dialogflow context must be provided to match the proper intent in conversation. There are two kinds of context in Dialogflow. Input Context and Output Context.

Contexts | Dialogflow ES | Google Cloud

  1. The end-user asks for information about their checking account.

  2. Dialogflow matches this end-user expression to the CheckingInfo intent. This intent has a checking output context, so that context becomes active.

  3. The agent asks the end-user for the type of information they want about their checking account.

  4. The end-user responds with "my balance".

  5. Dialogflow matches this end-user expression to the CheckingBalance intent. This intent has an checking input context, which needs to be active to match this intent. A similar SavingsBalance intent may also exist for matching the same end-user expression when a savings context is active.

  6. After your system performs the necessary database queries, the agent responds with the checking account balance.

So Let's wrap up part 1 of the Dialogflow basics article. To learn more about DialogFlow. Plases visit Google Dialogflow document site.

This is my first blog article on the hashnode. Let me know your thoughts in the comments. Happy Learning :)

All Images are sourced from Google.

5
Subscribe to my newsletter

Read articles from Prem Pawar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prem Pawar
Prem Pawar

Energetic and Curiosity Driven Computer Engineer with 1.5+ years of Experience in Google Cloud, Genesys Cloud, Java, Node Js, and ReactJS.