Getting started with Dialogflow
Ever heard of magic? That is
exactly what Dialogflow is.
Figure 1:
Dialogflow |
In this series of posts, we will discuss all Dialogflow and how to create a chatbot using it.
What is Natural Language Processing (NLP)?
Figure 2:
Natural Language Processing (NLP)
Here we will just discuss the tip of the iceberg named Natural Language Processing to get a gist of what Dialogflow does. Natural Language (example- English) is the language that we humans communicate. On the other hand, programming language (example- Python) is developed to give commands to computers. Natural Language Processing makes it possible for humans and computers to interact without the use of programming languages so that computers can comprehend written or verbal inputs from us. As a result, to imitate the way humans communicate, NLP models are developed. Natural languages are quite difficult to interpret correctly all the time because of grammar, idioms, context, homophones etcetera. So, a good NLP model should be able to interpret the sarcastic tone in a tweet saying “My flight is delayed. Great!” Some of the many uses of NLP in real life:
- Spam detection- The mails in our inbox are classified as spam because of the detection of language which suggests spamming or phishing. For instance, bad grammar and threatening language are some factors used to perform the classification.
- Social media sentiment analysis- Posts on social networking sites such as Twitter can be scanned to get hold of the reaction of people with respect to any product or event. This information can prove to be quite useful for marketing campaigns.
- Virtual agents and chatbots- Virtual agents like Siri, Alexa, and chatbots, which are now frequently noticed on many websites, are used to providing appropriate and helpful outputs such as text or actions, whichever are suitable, after examining the input from the end-user.
- Unfortunately enough, it is not possible to develop a natural language processing chatbot without using coding. Having said that, there are some user-friendly tools to help simplify the process. Well, where there is a will, there is a chatbot.
Figure 3:
Chatbot
Thanks to customers’ demand for assistance round-the-clock, the use of chatbots is skyrocketing. To enable customer engagement with the means of text, speech, images etcetera, and that too at any time of the day, artificial intelligence systems called chatbots are used. Insider Intelligence reveals that 40% of internet users prefer dealing with chatbots rather than agents. Moreover, in quite a literal sense, every industry ranging from medical to retail and finance is rapidly shifting to the digital market and chatbots have become a necessity for this very reason. Some well-known chatbots are eBay ShopBot and Lyft Bot.
Some amazing usages of chatbots are:
- Chatbots answer questions and queries. As an example, “What is the cost of the hairdryer?” or “What are the working hours of your company?”
- Book seats for events.
- Give personalized recommendations by analyzing customers’ replies.
- Collect customer feedback.
- For inventory management, such as looking for a particular item in the inventory.
- Integrating with ERP apps to get to know about enterprise resource availability.
- A bot giving illustrations to build another bot.
- A personalized travel assistant to help with tasks such as booking hotels with respect to end-users travel plans and comfort and so on.
Dialogflow (formerly Api.ai, Speaktoit) is now
owned by Google. It is basically a framework that provides “Natural Language
Processing” and “Natural Language Understanding” facilities. In other words,
based on Natural Language conversations, Dialogflow builds human-computer
interaction services. On top of it, this framework provides many
functionalities like webbook services and integration services which makes Dialogflow
quite a good place to develop a chatbot.
According to Google Cloud:
“Dialogflow is a natural language understanding platform used to design and integrate a conversational user interface into mobile apps, web applications, devices, bots, interactive voice response systems and related uses.”
Terminologies related to Dialogflow
Firstly, we should discuss an introduction to
the terminologies that will be used throughout this blog. Below is a snapshot
of a part of the Dialogflow console which displays some of the essentials of Dialogflow.
Figure 4:
Dialogflow Essentials
- Agent: A Dialogflow agent is quite similar to a human agent. First, it needs training. This training is specifically to handle human interactions which are, in a way, expected. Here, the agent’s name is ‘demochat’. Going further in this blog, we will learn all about creating agents and using them to create chatbots.
- Intent: The relationship of intent to an agent is many to one. In other words, one agent has multiple intents. According to the input by the user, a particular intent is matched, and this process is known as intent classification. Each intent has training phases, action, parameters and responses.
- Training phases are some of the phrases which are predicted beforehand and given to the machine. One point to note here is that there is absolutely no need to add ALL the phrases. You can add some of the phrases and the built-in machine-learning of Dialogflow envisions other phrases. In simpler words, if user is expected to enter some numbers (example- customer id) then training phrases would be some numbers.
- Action is used to link the matched intent with some specific actions. In the following snapshot, action is ‘get_name’.
- Values from the input from user are obtained by Parameters. Continuing the above example, if expected expression from users is a number, the entity type would be identified as ‘sys.number’. ‘sys’ suggests that it is a system-built entity and not a user-defined one. To access this value by user, ‘$name’ will be required to use.
- Response, as the name suggests, are text, image or any other response which are to be returned to the user. ‘Custom Payload’ field is used to pass rich-content to the user. Examples of rich-content include image responses, suggestion chips and so on.
Figure 6:
Responses
- Entities: As discussed earlier, some common sort of data like numbers, date, time, and etcetera can be identified by system itself, known as system entities. We can also define our own entities known as custom entities. As an example, an entity named drink can be created with names of all the drinks like tea and coffee. In this way, when a user enters some expression along with the name of some drink, the entity type would be identified as ‘drink’. Furthermore, this same value could be used to give out a response or else perform an action, etcetera.
Figure 7:
Custom entity |
Figure 8: Detection of custom entity
- Fulfillment: Whenever a developer wishes to give dynamic responses, fulfillment comes into play. What I mean by dynamic responses is, for instance, the user wishes to extract name of a customer from database by using customer id provided beforehand, then fulfilment needs to be enabled for that individual intent.
- Integrations: Dialogflow provides integration with a number of platforms. This can be used to create an agent on those platforms. Some examples of built-in integrations of Dialogflow are Dialogflow messenger (which we will be using), Dialogflow web demo, LINE, Slack, Telegram, etcetera along with some partner built-in telephony integrations, Google-contributed open-source integrations and independent integrations.
Do let me know if you think any other integration than Dialogflow messenger would be better to work with.
Conclusion
Today what we discussed was just the beginning or should I say
just a trailer video of this amazing movie named Dialogflow. Although I hope
that you understood today’s topics, do not feel overwhelmed at all if you
didn’t understand some portions. Going further, we are going to get into depth
of all the terminologies and the features of Dialogflow and implement the same
to develop a chatbot. The uses of chatbots truly amaze me! Do comment about any
innovative or unique chatbots that you have interacted with or heard of that
has amazed you.
I am open to any suggestions or feedback related to this post. Thank you.
References
- https://cloud.google.com/dialogflow/es/docs
- https://www.businessinsider.com/chatbot-market-stats-trends?IR=T
- https://en.wikipedia.org/wiki/Dialogflow
- https://www.ibm.com/cloud/learn/natural-language-processing
Amazing blog. Very useful and informative.
ReplyDeleteAmazing write-up. Great share!
ReplyDeleteInformative and interesting article!
ReplyDeleteGreat share and amazing information...
ReplyDeleteAt first I thought it'll just normal blog but after reading it I get my answers of my questions.
ReplyDeleteVery informative and great write-up
ReplyDelete