IBM Cloud - Post - 1 – Creation of chatbot using IBM Watson :
Chatbots are used as a virtual assistant to handle customer requests which requires minimal action. It is also used in collecting all the required information from the user before the request is forwarded to a human agent to accomplish activity, it helps companies to achieve maximum productivity at a minimal cost , in this post let’s see how to use IBM Watson conversation service to create a chatbot,
Watson Conversation components: There are three components in IBM Watson chatbot, lets see what they are,
Intent - Goal or purpose of the user’s input, starts with a pound symbol
Entity – identifies the core details in the user’s input, starts with @ symbol followed by parenthesis
Dialog – Contains nodes which provides responses to the user’s input.
Go to https://console.bluemix.net/ and get a free tier account. Please be cautious in selecting the premium service as it will incur charges to your credit card.
The Watson service that we are going to create falls under the free tier, so we are good. Go to the services section , click on Watson and click on Watson Conversation,
Select the lite-plan service and click on create
Now click on the launch tool and create a workspace to maintain intents, entities and dialogs
There are two classification of intents, one is chit-chat intents and the other is domain specific intents.
Chitchat intents comprises greetings [hi, hello, heythere], Thankyou [Thanks, Thank you very much] and Goodbyes [bye, seeyou]. The common phrases used during the beginning and the end of a conversation.
Domain specific intents – are intents which are specific to the domain or business , like in the case of flower shop chat bot, Delivery location , type of flower for occasion etc.
Lets go ahead and import the intents, Select the CSV file and click on import ( the csv file is available for download at the bottom of this post)
After it is imported, you will see the below intents under the intents section,
Lets try if the intents are working properly, it should direct to the correct intent based on the input given in the try it out section.
Now we will go ahead and create the entities, entities are like the subject of sentence ,
Flower suggestions for my valentine’s day?
Flower suggestion for my wife ?
In the above examples the entities are valentine’s day, wife.
So we need to create the entities which will classify the @occasions and @relationship_types.
There are also system entities which are available , which can captures numbers, date and time , location , currency etc, you can enable them as per your business requirements.
Now lets go ahead and import the entities csv file ( The file is available for download at the bottom of this post)
Post import Watson will train on these entities, once the training is complete, we can test them for accuracy,
In the Dialog’s Section, after you click on create, you will see there are 2 nodes which are created by default,
Welcome node, contains the initial greeting by the chatbot, you can modify it as per your chatbot requirement, the anything_else node contains responses for irrelevant questions given to the chatbot, you can also customize this as per your need. It is recommended to have these nodes for any chatbot.
You can add and customize the child nodes to give specific responses for the intents and entities selected. This is where you write most of your logic , try to get as many scenarios as possible, list them down as a table , to give specific responses, It is recommended to introduce to the user during the greeting message on what your chatbot can do ( which implies what it cannot do ), so the questions are directed based on that.
The nodes are traversed on top to bottom approach, if one of the nodes satisfies the logic it gives the response and waits for users input, so in the case of follow up questions by the chatbot arrange the nodes in such a way , it jumps to the specific node and asks the relevant questions to the user.
When specifying entities with space or special characters in between include them in parenthesis and when you want to specify an email in the response use “\@” backslash to interpret the @ symbol.
I have attached the json file at the bottom of the post, which is an export of the workspace, importing this json file will provide you all the intents, entities and dialogs, so you don’t have to create them manually, You can visit the dialog section on how the flows are defined for further understanding.
You can also delete the previous workspace “chatbotFlowerShop” that was created if required.
Under Dialogs , you will be able to see the nodes that were created.
Once the chatbot is created, you can deploy it your application or to your social channels like slack, facebook and twilio , you need to connect to the IBM cloud Watson workspace using the below API gateway url and provide the workspace id, username and password.
IBM Watson provides advanced concepts like indents[x].condition, context variables , slots and handlers to further enhance the chat response configuration by handling user inputs.
The improve section helps us to view the conversation metrics and logs to enhance the user experience.
Thanks for viewing the post,
please post your comments below.
Please Like & Follow us on Facebook & Twitter,