Introduction to Chatbots
Introduction:
Chatbots are every where in the current industry with starting from automated reply bots, from website greeting chatbots, to zomato's complaint chat bot and upto sophisticated companion ai chatbots in chatting apps. Building and discussing about chatbot is a part of natural language processing, understanding and generation task. In this article, we will describe the basic ideas of how chatbot works, what are the different parts, and we will vividly draw inspiration from the google developer course taught by priyanka verdegha called "deconstructing chatbots."
Summary of the article:
In this article, we will go through the concepts of what is chatbot, how dialogue works, what are intents, context, and, how the actions are performed by chatbot. This is the first of the chatbot series which I will be writing over january 2021. This post will mainly discuss around understanding the concepts, while in the next posts, we will create chatbots using dialogflow and RASA NLU framework which is famous for creating chatbots.
what goes on in the back of a chatbot?
Ever wonder? what is going on in the back of that small chatbot which springs up when you enter a new website; or when you want to log a complain in an automated site and other things. There is a normal 3 layer structure inside a chatbot. Look at this picture from bigdatamadesimple.com below:
So, there are basically 3 parts of the chatbot programs. These are:
(1) front end of a chatbot:
This is the part, generally end users see. This is a chatting interface, either in a website or some social media or some app interface. Here the users provide their chat response and get the responses from the chatbot back.
(2) NLP layer or the chatbot engine:
This is the most important part. Here, a natural language processing script takes the user inputs, breaks them down to find out the "intents", "context",and "entities" in the user input and then passes these to the back end for running the necessary operations to generate the response.
(3) Back-end:
This is the part where we have either a database or some active api or something else. This is basically the part where, the already processed input from user comes and triggers specific business processes; all ultimately boiling down to create a response.
Finally the response then comes from the back-end and gets through the NLP layer again to transform the response into acceptable chat format and then finally the chatbot "replies" to the user.
Let's go through this process with a basic chatbot available at a bank's site. For example, consider that you land on the home page of your bank and there is this information chatbot present there. Now you ask the chatbot,"what are home loan options?"
See here you are using the front-end of the chatbot and your user response "what are home loan options?" reaches the NLP layer.
In NLP layer, the question is processed by machine learning models and the models detect that "home loan" entity is asked about. It also understands that the user wants to know "options" which is the intent. Then these two things are passed back to probably a company API, which queries the company database about generic public information for home loan varieties.
Probably a site or a pre-stored faq link is generated as a result of that query; which is now passed back to the NLP layer. The NLP layer forms a acceptable chat by adding the link to a pre-formatted sentence like "here are the options you can opt for: <link>"
And this sentence is then produced by the chat bot.
So this is how a chatbot works in general. But probably you have already raised your eyebrows and be asking like, "thats all good and nice but what are intents and those other terminologies?" Before that, let's
Create a Basic Chatbot using dialogFlow:
In this section we will create a basic chatbot which schedules appointment for you in google's dialogflow tool. First,
(2) Then go to the create agent option from the left side's drop down option, and click the create agent like this below pic.
(3) give a name to the agent; and create it. On doing so, you will see that the button will go into working for sometime, and then it will be done; as well as two intents will open up; which are:
(a) welcome intent: this is an intent for welcoming the user by default.
(b) default fallback intent: this is an intent for the bot to fall back whenever it doesn't understand the particular user response.
(4) You can test out the bot at any time now using the available console in the right side like this.
(5) Now, once you create this default bot, the obvious next bit is to create intents. So to create an intent, I will give you a basic sense what intent is. Intent is basically a classification of user responses, like a category. For different responses types or action types, we create different intents like this. In this bit, we will create one intent. For creating a new intent, click the intents option from left, and the screen will look something like this:
Now, once you press "create intent" a new page opens like this:
So as you can see, there are these following things you will have to enter,
(1) intent name (2) contexts (3) events
(4) training phrases (5) Actions and parameters
(6) Responses (7) Fulfillment
Now, a lot of these are a bit complex things, so I will briefly provide the dialogflow's description for each of the item names.
what is context?
what is events?
what is training phrases?
what are actions and parameters?
Parameters are specific values extracted from a user's request when
entities are matched. The values captured by parameters can be used in
fulfillment, or in building a response.
If you mark parameters as required, Dialogflow will prompt
the user if their values were not extracted from their initial request.
what is fulfillment?
Comments
Post a Comment