WHAT OUGHT TO BE when we say — the most powerful AI accessible chatbot
WHAT OUGHT TO BE when we say — the most powerful AI accessible chatbot
I recorded a video to give a context to this topic and without further ado, I would suggest to watching the video first — -
WHAT OUGHT TO BE when we say — the most powerful AI accessible chatbot
I recorded a video to give a context to this topic and without further ado, I would suggest to watching the video first —
When Jon Snow said “NO” to going to King’s landing and the meeting happened by [WoBot](https://workboard.zendesk.com/hc/en-us/articles/115007128928) in Slack
#### Great, thank you!!!
And now Let’s see what actually happened here in the video —
1. 15 seconds from S7E7 — The Dragon and the Wolf 2. [WoBot](https://workboard.zendesk.com/hc/en-us/articles/115007128928) — It is a personal agent and the most powerful AI chatbot (Developed with 💕 by the team at [Workboard](http://workboard.com/)) that runs in conversational chat clients (e.g. [Slack](https://slack.com/)). 3. And you guessed it right, I am not from the marketing domain and the video is not meant to show the capabilities of the WoBot. It’s out of scope for this topic because WoBot is much more rich in terms of the functionalities and understandings as compare to the ones captured and demonstrated in this 6 minutes video which is focused on one microservice related to scheduling and meetings from this bot.
The video is very much required as it opens a pitch for my conversation with you today —
> ChatBots — Under The Hood
Lately I have been involved in a team, developing a chatbot with the deep learning and came across different chatbots and underlying AI (Artificial Intelligence) cognitive providers from Google [Dialogflow](https://dialogflow.com), [IBM Watson](https://www.ibm.com/watson/developercloud/doc/conversation/index.html), Facebook [wit.ai](https://wit.ai/), [Microsoft LUIS](https://www.luis.ai/), [Amazon Lex](https://aws.amazon.com/lex/), [Chatfuel](https://chatfuel.com/), [Pandorabots](https://www.pandorabots.com/) and fore more control, build the similar service stack using [TensorFlow](https://www.tensorflow.org/) or [Torch](http://torch.ch/).
There are a large number of chatbots available (I am not saying — AI accessible chatbots) across different chatbots’ marketplaces like [Slack](https://slack.com/), Facebook [Messenger,](https://www.messenger.com/) [Kik,](http://www.kik.com/) etc-. And the reason for this massive number is —
> Today, AI is approachable!
You don’t think about leaning the ML algorithms (though I have a strong recommendation of touching some ground about them before you use AI as a service or build one) and training your ANN model, rather you focus on a solution with the help of these services today.
> A little background before we get into the serious part!
Back in 2010, I submitted a chatbot proposal in my company for a tech vitality event and I called that Developer Agent. A developer agent was an AI agent that can encapsulate and bundle the same level of understanding as the developer(team) of the product has and can solve customer’s problem before the customer actually encounters it and the customer could talk to the agent to get forehand help. In case of the problem, the agent could help in gathering all the required information to reduce the back and forth communication between support channels (level-1, level-2, etc — ) and the customer, taking preliminarily measures which are generally documented steps in product support documentation and updating to the knowledge base for the known problems and resolutions. At that time, I presented an ANN (Artificial Neural Network) based AI solution.
I knew, how powerful it would be if I could have built that. And today, these agents are called virtual agents for the product’s support \[I didn’t build them!\] — a support chatbots; mimicking human knowledge and solving thousands of tickets a day without a single manual intervention.
> Today if you start a deep learning PoC, you can see the outcomes, you can implement a working prototype solution over a weekend and I see the immense opportunities that It will be bringing in the future.
> Let’s talk about the real part and what happens under the hood when you implement a chatbot which is AI accessible:
When you talk to a chatbot —
1. The chatbot tries to understand what you are trying to converse — Which is extracting the user Intents 2. Once intent is identified, the bot tries to extract certain objects and properties to classify this intent — which is extracting the Entities 3. Conversation branch (Flat or Hierarchical): Then it traverses to the most appropriate conversation branch on the basis of the intent, entities, and context. Depending on your implementation and AI service provider, you can implement a conversational branch and let the bot traverse it BUT while designing it, always think, in real life, conversations are not flat, it can go in any direction. Hierarchical conversation branches are the most powerful when you are supporting a chatbot application at the enterprise level. 4. Context: For a chatbot, the context is the most important one as it is its knowledge base. It is the understanding, that helps chatbot deciding whether to continue conversing or full fill the user action with a response or hint, with the conversation interfaces options (like buttons/menus/commands). 5. Finally, the chatbot charms you with the most appropriate response. Or may annoy you with — “I don’t understand what you are saying :-/ ” (Never use this in your bot!)
#### Yep, the harmony of only these five steps derives the success of your chatbot.
> The purpose of this article is not to tell you how to develop a chatbot using Google API.ai or IBM Watson or Amazon Lex or other cognitive services that you can do with a simple search on blogs/YouTube. Trust me, there are great articles out there that can help you to get started on a chatbot over a weekend.
I would rather share the experience and best practices that can help you to be successful in implementing an awesome chatbot experience.
#### Let’s break it down —
#### Intents —
They are the true friends of the bot. The bot has to understand what is user’s goal and interest when the bot receives “Order a pizza”. As a developer or product-owner, it’s your responsibility to provide as many user stories as possible that can define the intent of a particular class. One simple analogy, I recommend while defining your intents as a CRUD operation, for e.g.
Few intents examples for the pizza bot —
1. Create: Order a pizza/Take my order for a pizza/Can I get a pizza?/Place a pizza order etc- 2. Read: Get my pizza/Can I see my last order/Where is my pizza? etc- 3. Update: Can I change my order?/Can I add some more toppings? etc- 4. Delete: Cancel my order/Don’t want it etc-
#### Entities —
It is the most relevant data type or an object that you can extract from the user’s input. Here, I recommend to think them as filters or future classifiers that can help you to drill down further to converse with the user, for e.g.
1. Order a pizza {entity: meal, entity\_type:pizza}: Here type of pizza is missing, so the bot can ask Which type of pizza would you like? Or You can pick-up a one from this menu, I am giving 50% if you order two large pizza! 2. Can I get meat lovers with extra pepperoni toppings \[entity: meal , {type:pizza}\], Entity: pre-built pizza, Entity: topping, Entity: Quantity\]
#### What will happen if my conversational or dialog services do not recognize the intent and entities?
There are cases where this happens and your bot probably ask for the more inputs. Most of the conversational or dialog services include natural language understanding response but if they don’t, you can still build your own natural language understanding micro-service.
Let’s pick up an example to understand this —
You ask- I want Papa John’s Favorite, the one that is served in Campbell’s downtown!
Your bot is an ambitious bot, so instead of asking for more input, bot analyzes NLU response which looks like —

NLU response
With this response, the bot can understand that your input has two important entities; person and location. And with the help of semantic\_roles, the bot can further decide your intent. NLU helps the bot to provide personalized and more human-like responses.
#### Conversation branches (Dialogs) —
The branches are the heart of your chatbot application. It defines the various path that your bot traverses with true and false criteria. The branches help the bot to jump, switch and the response to the user questions.
Flat branches are useful when the bot’s fulfillment depends on the set of fixed required inputs. The flat branches are referred as Slots in most of the AI service provider and once all the slots are filled, you can execute the bot’s fulfillment. For e.g. —
Once your pizza order is done and the bot is deciding for the delivery option, it may need —

Here, you can create these three slots, asking the questions for the required inputs (your AI service provider will execute them in the order they are defined) and once all the inputs are received, you can execute the next action.
Hierarchical branches are many flat branches having a root (conversation start node), forming a graph structure and more close to the real-life conversation. They get complex when the conversation gets deeper and hard to design and implement if you don’t have a deeper understanding of context switching and maintain the states. BUT they are powerful and make your bot more human-like interacting entity.
To explain the conversations in the hierarchical branches, itself a very broad topic so I will cover this again as most of the articles out there, talk one aspect of this kind of branches (that is how to get started with them).
But (I will talk about this very soon in the next blog…) —
> The hierarchical branches can be extended and broken to connected branches to solve problems like the utterances ambiguity (the double intent issue) and how to create deeper conversational feel rather the form-filled experience of the bot.
#### Context —
If the dialogs are the heart of your bot, context is the mind. A context-less chatbot is nothing more than a bunch of if-and-else statements. Let’s pick up a slice of pizza again and understand it in more detail — You are building a personalized order of a pizza with the pizza bot and the bot has following context (here I am presenting the context as JSON object, this is one way of representing the context as accepted in Lex/Watson/Api.ai(now Dialogflow)):
{“order\_id” : “XXX”, “cell\_num”:”xx@x.x”, “pizza\_details” : {“toppings” : \[“pepperoni”, “onions”\]}, “available\_toppings” : \[“sausage”, “bacon”, “spinach”, “chicken”\] … }
> Before executing the order, you say — ‘What about pepperoni?”, with the context, your bot can confirm with the current toppings object and can suggest of for the new topics, for e.g. ‘Got you covered for this one, do you want to add sausage or spinach?’
The context is your control over the bot, empowering the bot what your pizza application knows. For e.g. after ordering the pizza, you say — ‘send the receipt to my number’. Here your bot can execute this action.
The context is also very powerful when it comes to creating many hierarchical branches. The user-defined entities or system define entities \[system conversation branches\] are to create branches for taking the conversation in one direction. But with the help of the context, you can even create deeper conversation branches by speculating where this next conversation can go without affecting the system conversation branches.
Let’s have one more pizza slice and understand this with another example…
> \[bot\] All set! your pizza is on the way \\\_/
> \[you\] Can you venmo Amy, Jon, and Anuj.
> \[bot\] You got it, boss!
Here the bot is invoking another API endpoint as you have already integrated your bot account and you can switch the context to another conversation branch that is related to payments but you are supporting your pizza bot. Another benefit of context-based branches is having a control of the hierarchy in your application, this way you can do the on-demand invocation of the cognitive service.
For e.g.
> In your group order of the pizza, you ask the bot, Wait until you get confirmation from Angela
Assuming, in your contact list, there are two Angela, your bot can keep the dialog context until this point and do an external look-up call to your contact and keep the conversation going.
The one recommendation here, which I find helpful, is to create this contextual branches in the AI service provider that provides deeper support of branching, patterns matching, more intent recognition and entity extraction.
With the help of the context, you can make your bot more personalized and smart. For e.g. —
> \[you\]: Need to place an order for Friday’s bash
> \[bot\]: Luck you! I don’t get those :-/ you went with this order in the last bash, do you want to repeat?
With the help of the last order context, the bot can surprise you and provide the more personalized response with the contextual conversation.
#### Responses —
With the help of the responses, bot develops and depicts a personality. It’s your ability to make it a star with the human likes responses, giving a certain personality to the bot and providing a direction to the conversation with the help of conversational UI.
Here I want to focus on conversation UI elements or I often call them hints —
When you are releasing your bot very first time, you always have a fear of losing it with the next question that your customer may ask. Instead of making the bot 100% conversational approach, you can let your bot adapt a learning curve where your bot redirects the conversation with the next possible conversational branch.
Let’s pick up another pizza slice and understand it in detail —
During your conversation with your bot, you are adding topping in the pizza and you said…
> \[you\] Add BBQ chicken in my pizza.
> \[bot\] Done, would you like to place an order now?
> Buttons: \[Add bacon\] \[Add sausage\] \[Make 4 cheese\] \[Make thin crust\]
Here with the conversation hints, the bot is redirecting the conversation with the direction where it knows, it will not go wrong.
> Maturer the bot gets, lesser you can put these conversational hints!
#### Bot testing —
In most organizations, the bots’ project spin-off as proof of concept and because of the nature of the project (it has to act fast as per the feedback), you have to cover all the basic grounds of the engineering. You are a good developer, so I assume, you are writing your unit test cases, but the important part of the bot testing is functional testing. Because with the bot functional testing, it is black box testing, where the next conversation can go to any direction. The steps in this testing is context driven and you can follow a simple strategy to have functional bot test cases —
1. Mock and run: Mock and cover all the functional test cases for different branches as standalone functional test cases. The strategy is like step forwarding in the case of API testing where you use the request variables as a result of output from the last API call. 2. Develop a test-bot: I love this strategy and I am not sure whether there is a well-documented industry practice or product out there but in this strategy, you mock a test bot that is talking to your product bot. The design of test-bots is to cover all the branches starting conversation start node and then random jumps. This strategy is also very helpful in identifying any broken conversational link and fixing it. 3. Start with Beta: I found it useful, always doing a major release of the bot as beta. It is the strategy that we follow in mobile app releases where we select a dedicated set of users and work with them as per feedback. Here you get the real feedback from the field instead of mocking it.
Please feel free to share your best practices in your chatbot testing!
#### Bot conversion analytics —
I was often asked, how do you measure bot conversions (whether your bot is converging)?
And it is very valid and important question as you have to keep making your bot a better version of it from itself yesterday. I prefer one of the marketing strategy here which is the [funnel analysis](https://en.wikipedia.org/wiki/Funnel_analysis), but here instead of event conversions, the funnel lets you see where your bot loses the conversation.
> So how would I do that?
It’s simple and three steps process which is —
1. Identify a favorable conversation branch 2. Identify all the events in that conversation branch 3. Create the funnel with the ordered events as per the timely occurrence of the event
I hope, you already got your slice by now, here the e.g. —
1. The favorable branch; customer praising the bot after placing the pizza order! 2. Events; e1: bot presenting the menu, e2: customer customizing the selection e3: bot helping the selection e4: customer placing the order e5: bot confirming the order e6: customer saying “thank you” 3. Funnel of e1->e4->e6
The funnel enables to focus on the data to make your bot more successful and the bot analytics is a topic itself and I would love to discuss some other day.
I would like to close the experience with the challenge that an app developer or a chatbot developer faces that is —
> How to keep you bot engaging with your users? or
> How to keep your users interacting with the bot?
You should have an urge for your bot to succeed rather spamming the users to talk to your bot. When you persuade your users to talk to your bot, it becomes your uttermost responsibility, you are doing this being data-informed rather data driven!
For example, presenting a new non-vegetarian pizza launch as a notification to all your users who have placed a non-veg order at-least once earlier is data-driven.
But to present this launch to the set of users who have browsed the non-veg menu but never ordered is being data-informed where your intuition is; They didn’t like what they saw and now they will love this!
Feel free to share your thoughts on the challenges…
Originally published at [www.linkedin.com](https://www.linkedin.com/pulse/what-ought-when-we-say-most-powerful-ai-accessible-chatbot-nigam/).
[](https://chatbotslife.com/bot-communities-mastermind-group-d2dae9876709#.53x0py6ou)
[](https://m.me/ChatbotsLife)
[](https://chatbotslife.com/how-to-get-a-free-chatbot-b1fb9dfe109#.z9dtp2sy0)
— Gaurav
Responses