Build easy conversational AI – GCP Dialogflow

high angle photo of robot
Reading Time: 3 minutes

Dialogflow is a GCP framework that enables users to develop easy human-computer interaction technologies that can support Natural Language Processing (NLP).

Basically, Dialogflow handles the job of translating natural language to machine-readable data using machine-learning models trained by your examples.

Why use GCP Dialogflow

A few reasons to use Dialogflow are –

  1. It can be easily integrated with messaging applications such as Twitter, Skype, Kik, Viber, Facebook Messenger, Telegram, Slack, and Twilio, and also for several voice assistants such as Microsoft Cortana, Amazon Alexa, and Google Assistant.
  2. If you want to learn how to build a chatbot, the free version is also available.
  3. It uses the concept of NLP (Natural Language Processing).
  4. It also offers us with Knowledge base feature, where we can upload the knowledge document through an HTML link or CSV file. And that can be used for end-user conversation.
  5. It can integrate with automated phone services also.
  6. It supports 20 languages with 14 different platforms for deployment.

Building Blocks of GCP Dialogflow

AGENTS

The agent is basically your entire chatbot application which goes like collecting what users are saying mapping it to intent and performing certain actions on it. Followed by producing the response for the users. This all starts with a trigger event called an utterance.

INTENTS

Let’s take an example to understand what are intents – “Hey Google, what’s the weather like today?”. Here, “what’s the weather like today” is the intent.

Dialogflow basically trains the model with such intents and with many similar ones, then maps the user intent with the right intent. This process is known as intent matching.

The following things are comprised of the basic intent:

  1. Training Phrases
  2. Action
  3. Parameters
  4. Responses

Training Phrases – Training phrases mean example phrases for what the end-users can say. If one of these phrases resembles an end-user expression, then the Dialogflow matches the intent. There is no need to define each possible example as the built-in machine learning of Dialogflow expands with other related phrases on your list.

Action – For the agent, we can define an action. At the time, when we match an intent, then Dialogflow gives the actions to the system, and the action can be used to trigger various actions that are already defined in the system.

Parameters – At run time, if we want to collect an intent then as a parameter the Dialogflow gives the value from the expressions of the end-user. Every parameter contains a type known as an entity type, and the entity type exactly dictates how data is retrieved.

Responses –  We can define speech, visual, or text replies to return to the end-user. These are able to give the answer to the end-user and also ask for more information from the end user and can also terminate the conversation.

The below figure shows the basic flow for intent matching and responding to the end user.

Dialogflow Tutorial

ENTITIES

The intents provided by the user have a type known as Entity Type.

When a user wants to extract the entities from the end user expression. Dialogflow offers to do the same in two ways –

  1. System Entities
  2. Custom Entities

System Entities – The Dialogflow offers us various system entities to match common data. For example, there are various types of system entities for matching email addresses, colors, times, dates, etc. 

Custom Entities – For matching custom data, we can also make our custom entities. For example, we can define a medical test type entity that matches the kinds of medical tests which are available to book with the agent of a medical chatbot.

Conclusions

Dialogflow is a google framework that can be easily used to build conversational AI. It offers us various benefits like easy integration and deployment, easy creation of chatbots, knowledgebase, etc.

Reference

  1. https://marutitech.com/build-a-chatbot-using-dialogflow/
  2. https://www.javatpoint.com/dialogflow
  3. https://cloud.google.com/dialogflow/docs

Written by 

Tanishka Garg is a Software Consultant working in AI/ML domain.

1 thought on “Build easy conversational AI – GCP Dialogflow3 min read

Leave a Reply