Cornerstones While Building A ChatBot
Rana Pratap Singh
Technical Lead @ Yubi | Technical Leadership, Microservice Architecture
I spent the last 4 months building a Conversational AI Bot/Personal Assistant Bot. While it was an exciting and challenging project, though there were quite a few difficulties that I faced. After overcoming them and successfully deploying my Chatbot, I have realised that following are the things which need to be focused on — conception, training, building or connection.
Building a bot is a rewarding experience: creating your own artificial intelligence is amazing! However, it can be a challenge.
Conception
Building a bot doesn’t start at the first line of code. It starts much earlier, during the conception.
During that first step, it’s important to define the use case of your Chatbot. What is the problem you want it to solve? What are your business needs? We often see people saying “I want a bot that does this”, but when we dig deeper, we realise a different bot would actually fix the issue much more efficiently. If you want to build a Chatbot that manages customers’ questions on return policies, but later realise that these queries are less than 2% of your global volume, you might want to switch to another topic. So, start from the business problem and build from there.
Modelling/Thinking through all possibilities allows you to make sure every topic is covered and gives the developer a good overview of what needs to be done.
During this step, remember your audience: who are the end-users that will be talking to your bot? You have to make something that works for them.
Do not forget to include small talk in your conception. All Chatbots are expected to understand and reply to a number of topics unrelated to their mission: jokes, weather questions, “how are you doing”, remarks like “will you marry me” and even some nasty stuff. Be sure to plan for these if you want the user to be satisfied with the experience.
Training
Training the bot is the most important factor in determining its performance. Bad training will inevitably lead to a poor performing Chatbot and frustrated users. Always try to train your bot on large data sets, to make it give satisfactory results and be more comfortable for the users.
Based on the flow you’ve created during conception, training consists of creating intents and filling them with expressions.
Never train your bot only with the development and project team: they know the technical slang too well to accurately represent the people that will actually use the bot.
Tagging entities has a few rules. Entities are keywords that you need to detect in a sentence to extract information (the key point here being “to extract information”). You don’t need to tag every noun, adjective or word per sentence just because you can! The point of entities is to extract relevant information that you can use in your code.
A common best practice for big bots is to use intents and entities hand in hand. It's better to create a global intent and use entities to specify the user request, than create very specific intents that the classifier will confuse as they overlap.
Building
Building a bot is often assumed to be just building the conversation flow. That is not the case. It's the fun part! It’s when everything comes to life. However, it can be a scary process too.
The first thing to understand is that it’s okay to use multiple skills to complete one task. One skill doesn’t have to equal one full process. It can be a good solution to create one “mega-skill” who’s job is to dispatch the user input to the correct skill.
And if something doesn’t work, be sure to use the logs to understand where the problem is coming from. I would prefer: logrotate.
Connecting and user experience
When connecting your bot, you have to decide where it is going to be available to your users, and therefore work on a user experience. There are a few things to know to provide an enjoyable UX, the first one being: your bot has to look pretty. An attractive bot with plenty of buttons, graphic elements, HD pictures, colors, and a good personality makes all the difference. But how do you get that?
Then, keep in mind that a Chatbot is a conversational interface. Conversations are interactive exchanges; therefore, your bot should never reply with long-winded blocks of texts (not more than 60 characters).
Separate replies into different messages, use images, buttons, lists and other UX components. Your bot isn’t an FBI agent, nobody wants to be asked 20 questions before getting an answer. Instead, create your flow and UX to provide an answer every 1 or 2 exchanges to keep the user engaged.
Giving a personality to your Chatbot is essential, but you have to find the right balance. I would advise to let your users know that they’re talking to a bot. It’s simply expectation management! A human talking to another human is going to expect the highest level of interaction, whereas a human talking to a bot is going to know that they can’t ask about anything and everything. However, don’t make it too robotic: give it a name(JARVIS), an image, and use smileys and tone of voice to make it memorable.
Maintenance
Once your bot is in production, your job is not done! Maintaining your bot is an essential part of its long-lasting success. This mainly consists of fine-tuning your training and monitoring what your users are saying to adapt your flow or create new use cases.
When training, proceed with caution. While it is important to add new user sentences via the log feed, Keep in mind that all intents have to be trained the same amount! If one intent has 100 expressions and the other has 10, that’s no good. Therefore, check regularly when assigning new expressions.
Finally, your log feed is the place where you can see what users are talking about. Do you see a topic that your users are raising frequently that your bot doesn’t yet manage? Then incorporate it in your bot. That’s the best way to show your community that the bot they’re using is always striving to provide a great experience.
With all this in mind, you are fully on-board to build a first kick-ass bot!
Happy building!
Stay tuned for the next part of this article in which we will talk about tech stack for Chatbot development.
"J.A.R.V.I.S., sometimes you gotta run before you can walk." Thank You Mr. Stark. I Love You 3000
Staff Engineer | Engineering Leader | Expert in Cloud & Distributed Systems
5 年That was good read. Thanks for sharing Rana Pratap Singh
Chief Gecko a.k.a CEO @HRGeckos. Podcast #HRBytes | LinkedIn Top Human Resources Voice
5 年Great article! Thanks for sharing. ????