Yes, you read it right

Anyone can create a chatbot 🤖 without writing a single line of code. we can achieve this by using Google’s Dialogflow.

What is Dialogflow ?

In short, Dialogflow is a natural language understanding platform that can be used to create conversational agents which can be used to create chatbots, audio response systems ..etc without writing a single line of "Code".

If you want to know more, here’s a trick = google it.

What are we making!

A highly intelligent agent which uses deep learning to understand the soul essence of the sentence you are saying, by using almost 1000 lines of python code. Extracted from various git source which converts your speech into a fully functional Jarvis which can understand your feeling’s and be with you throughout your life.

Photo by Lucas Pezeta on Pexels.com

Just Kidding
we are making a simple shopping agent to add and remove items from your shopping cart.

Let’s start

1. Creating an agent

First go to https://dialogflow.cloud.google.com/ for starting to create your own bot , one you are on the dialogflow site click on the create agent button and give your agent a sweet name in your case it is “ShoppingAgent”

As this is our only agent we will not set the agent type as “Mega agent” (We set the agent type as a mega agent when we have multiple agents and we need a single master of all at this time we set the agent type as a mega agent and add our other agents as sub agents)

2. Entities

To make a simple bot we need two things in dialogflow first is “Entities” and the other is “Intents”. Entities can be understood as any real-world object e.g Person, Car, Time, Color, City, Country…etc.

Dialogflow provides us with two types of entities:

1. Custom Entities: These are entities/words and their synonyms/regex we provide to dialogflow so the dialogflow understands what are the entities in a given text

In our case, we have created a custom entity as items_name and the other is action_to_perform (displayed later on this page) as you can see that we are having two items as “drinks” and “shirt” we also provided some synonyms to the same so as dialogflow can handle a variety of the same word.

This is the action_to_perform entity here we have two actions_to_perform “add” (adding item to cart) and “remove” (removing an item from the cart) and their synonyms.

2. System entities: These are the entities which are already trained/present in dialogflow. Some of which are @sys.color, @sys.person..etc.

2. Intents

Intents can be thought of as the intentions of the user. In our case user have two intentions i.e User can either add items to the cart or remove items from the cart, so we will two intents named “add to card” and “remove from card”

Each intent you create has two features that are of your concern when you want to create a “Simple” bot and that are “Traning phrases” and “Action and parameters”

  1. Training phrases

Training phrases are the sample phrases that you need to provide to each intent in dialogflow so that the agent can predict the intent when u say a sentence. For a properly trained/accurate agent provide at least “10 training Phrases”

Some training phrases that our ShoppingAgent has are

Add to cart training phrases

And some of “remove from cart”

Remove from cart training phrases

10 training phrases minimum if you want agent with better accuracy

Ya we have less than 10 “We Know” 😐

2. Action and parameters

Parameters are those entities that are detected in your training card

Actions and parameters detected in our training are:

3. Training and testing

Each time you make intents, entities, and save the agent is automatically trained you will see this pop up almost every time you save.

After training completes you can test now

We can see that we get responses as “Parameters” e.g for the above sentence dialogflow was able to extract keywords as action_to_perform “remove” and items to remove are [“drinks”,”shirts”]. This response can be taken to your Shopping App to perform the said action.

That’s it now you are ready with a simple chatbot.

Upcomming: In built agents in Dialogflow

%d bloggers like this: