Create a bot of yourself with Watson
By Adam Benvie | 7 minute read | March 16, 2017
Co-authors: Adam Benvie , Zach Eslami, Nada Zaher and Nathan Robinson
Want to create your own bot but too busy to read the full tutorial? You can import our workspace! Signup for a Bluemix account, create your conversation instance, import the workspace. Keep reading below for full details.
What do chatbots do?
Whether it’s answering questions for online shoppers, assisting customers file their taxes, or helping people understand their insurance policies, chatbots are enhancing experiences today more than ever. But the experiences that you choose to enhance is entirely up to you. To see how easy it is to build your chatbot and enhance those experiences, keep reading…
My not so technical background
When I started with IBM Watson as a recent undergrad in August of 2016, if I had been asked to?build a bot, it would have been the end of the line for me – I don’t code, and I’m not super technical.?Today though is a different story. This is the story of how someone – with no experience building?chatbots – can “bot themselves” using the IBM Watson Conversation API.? ? ? ? ?
? ? ? ? ? ??
What does it mean to bot yourself?
Exactly what it sounds like. The idea is to create a chatbot that can answer questions about you, as if it were you, without actually being you. So, it could answer questions about where you’re from, what you do for work, and when you graduated college. And if you’re ambitious, it can even talk to your mom for you when you’re “busy”.
Myself along with three other new IBMers-Zach Eslami, Nathan Robinson, and Nada Zaher-,who also had no experience building chatbots, set out to “bot myself” – and so now we give you, Adam the Chatbot (if you don’t have Facebook use this). Feel free to shoot some questions his way to learn more about yours truly. He’s a pretty simple chat bot, but the more question he gets, the more he learns and improves!
Step 1: Define Intents
Intents are the objectives of every bot. If a chatbot helps users handle expenses, the intents would be things like “view x (amount due)”, “pay y (bill)”, and “cancel z (account)”.
A chatbot that answers questions about you has the broad objective of providing information about a human being. Therefore, it helps to think of this information as it pertains to where, what, and when. In other words, the intents would answer “where did you x”, “what is your y” and “when did you z”. The actual intents would simply be “where”, “what”, and “when” (or location, general info, and time).
After you have your intents, the next step is to add utterances. Utterances in the Conversation API refer to the different questions your end users ask your bot. Under each intent, add questions that would pertain to them. Under the “where” intent you would add phrases like “where did you go to college” and “where do you live.”
Not only would you want to add as many “where did you [insert noun and/or action here]” as you can, but you would want to add the different ways each of these questions could be phrased. So, not only would you want to create the utterance “where did you go to college” but you would also want to add “did you graduate from a school in the U.S.”, “in what state did you go to university” etc. The more utterances you add the better.
Step 2: Define Entities
When we were building Adam the Chatbot, understanding the difference between intents and entities was our biggest challenge.
The best way to think about entities is that they are the SUBJECTS of intents.
So, in “where did you go to college” the intent would be “where” and the entity would be “college”. This allows single entities to apply to multiple intents. In this example “college” could apply to both the “where” and “when” intents.
Under each entity, you will also want to add values. Values are sub-subjects of entities. So, under college, you would have things like major, YOG, and classes, along with synonyms for each of these. The more synonyms you add for each entity value the better. That way someone can ask “what was your major” and “what did you study” and get the same correct answer.
Another tip here is to add descriptive words before certain entity values that could have more than one meaning. In this example “study” could be the verb or the noun. So, to help clarify the meaning in the context that it’s being used, you could add “you study” as a synonym for major, and “a study” as a synonym for home library.
Step 3: Creating Your Dialog
You’ve got intents, you’ve got utterances, you’ve got entities, and you’ve got entity values and synonyms. Now it’s time to build exactly how your bot is going to interact with users. In the Watson Conversation API this part is your dialog.
Setting up your dialog flow is all about logic. The dialog in the Conversation API is set up like a logic tree with many “if then” conditions. Each intent begins a node on the left and the logic flows from the top down through your intents. If a certain intent is triggered by an utterance, its node is opened and the logic continues to entities.
The logic within each node (i.e. through entities) also flows from top to bottom. A specific combination of #Intent and @Entity:value triggers a certain response to a question – this combination is referred to as the response condition. So, for “what was your major” the “what” intent would be triggered and then the response associated with the response condition #what and @college:major would be returned.
After you set up each “#what and @Entity:value” response condition, you can start having fun with responses. Here is where you can give your bot a personality. You can make your bot of yourself sassy, sarcastic, or whatever attitude the REAL you has. Zach and Nathan really went wild here with Adam the Chatbot which made him a lot more fun for people to play with.
You can also get clever with how you craft your responses so that single responses can answer multiple question. So, for “where did you go to college” you could have a response that says “I went to x, where I studied y, before I graduating in z”. This way you can nail “where” “what” and “when” in a single response.
Step 4: Training and Improving
Now it’s time to deploy your bot to some friends and family to see how it does. I can’t stress enough how important it is to deploy your bot ASAP so you can see how your bot handles questions. In our experience, we didn’t deploy our bot to real people until we thought it looked GREAT. Then, about 30 seconds after deploying it, people had our bot in a pretzel. Below is a real screenshot from my friend after he tried the bot for the first time….
After your bot has gotten a healthy amount of utterances from end users, you can use the Improve section of the Conversation API to improve and train your bot. For questions that didn’t trigger the correct intent you can add them so that they do. More importantly, you can start to see what types of questions are being asked that you may not have thought of. For example, with our bot, we didn’t anticipate how many questions we were going to get about my “favorite” color, book, sport etc. until after we deployed it.
After you’ve deployed the bot and improved on the results, re-deploy to even more people and improve again. Repeat this process as many times as you’d like. Through each iteration the bot will continue to improve as you train it to better answer questions. Sooner or later you’ll have your friends thinking you’re an A.I. wiz. And who knows, maybe it’ll help you get on better terms with your mom ??
Building Your Own (without the work)
To use the intents, entities, and dialog we used for Adam the Chatbot, sign-up for a free Bluemix account, create your free Conversation instance, and import our workspace?. Change the bot responses to be about you, and you’re off!
Start building a bot with a free Watson trial!