So I built a bot…

This was originally posted on Medium, but I’ve added some new stuff at the end.


My job at Mercedes-Benz is intentionally mysterious. But I can say that it helped inspire me to investigate the weird world of chat bots. To help me get started, I asked my friend Sandi MacPherson about how she made her bot. Based on her experience, I followed suit and tried making one myself. It has not even been 24 hours yet, and it’s been quite interesting so far…

Easy to learn, difficult to master

Sandi built her bot based on John Borthwick’s bot, Botwick. If you follow along with the instructions on how to make one of these, it’s actually quite simple to make. With nearly zero technical understanding (and a small bit of cash), you can get one up and running in about 15 minutes.

After looking at the chat logs that I have so far, it’s really interesting to see how people are using it.

It’s really easy to learn how to make one and start answering basic questions. Where I find a lot of the complexity is in understanding how to design dialogues. See, we humans learn how to communicate with each other over a long period of time. Formulating ideas and concepts into sounds, sounds into words, words into sentences, and sentences that communicate the original idea is a skill that we develop even long after we learn to speak. So building a bot that can have a deeper dialogue than just answering a few one-off questions is far more complicated than it seems.

Dialogue Design

It boils down into 2 items: a series of intents, and the responses to those intents.

In as simple terms as I can say, an intent is basically the topic of the dialogue, along with the key words or trigger words that the bot needs to pay attention to. In more complex dialogue routines, it will include some NLU/NLP (natural language understanding or processing) to understand the intent without needing to always pre-seed the intent with trigger words.

The response is simply how the bot should respond. This can accomplished in any number of ways. When designing a response, it is very important to consider the question the user is asking, along with the intent of the question so that you can ensure that the bot responds with in the right way.

Shallow and broad, or narrow and deep?

What I’ve learned so far is that you need to decide what your bot is going to be about. Why does this thing exist? What is it’s purpose in life? It feels a bit like playing a god where you have to decide what this little thing is ultimately going to do in its lifetime.

There are basically 2 approaches: broad but shallow, and deep but narrow. A broad but shallow bot is one that can answer a wide array of questions on any given topic, but without too much substance. An example would be like a short conversation with someone you just met and don’t intend to spend much time talking with.

On the flip side, a deep but narrow bot could answer numerous questions, but only within a specific topic. An example would be some kind of bot that answers questions on bikes and bike maintenance.

There’s no real right or wrong answer as to which style of bot you want to create, but like with a real person, deciding on what it will be can help you focus on designing the right kinds of dialogues.

Growing Pains

In John Borthwick’s post, he encourages you to borrow his data to base your bot on. I actually chose to start with a clean slate. Doing this means that you must put your bot through all kinds of tests to train it to speak better. Training a bot takes the form of having people talk to it.

In some ways, it’s much easier to start with an existing data set (like John’s) to help it be a bit smarter in the beginning. But again, this really depends on the purpose of your bot. What should your little bot buddy be when it grows up?

Ultimately it boils down to human behavior. In order to improve how a bot interacts, you need to understand human behavior and human psychology in some way. This is why shallow and broad chat bots are so complicated; a dialogue can really go in any direction. Any topic can be brought up, and with this kind of bot, if it is not designed to handle a particular dialogue step, the experience breaks, which can be disappointing. But it’s ok. Like an infant, it needs to learn how to interact, so as the parent of the bot, you have to expect some growing pains!

UPDATE: Improving the dialogue

A handful of people have interacted with chrisbot and its given me an opportunity to write about some ways I’ve found to try and improve the dialogue.

Open-ended or directed?

When designing a dialogue, it can be important to think about how to direct a conversation. Leaving a dialogue open-ended is fine, but at the same time, directing the dialogue can also be helpful. People may not know exactly how to interact with your bot. So  to help the user engage with your bot, you may need to direct the dialogue.

Lead with questions

What can your bot say? What can your bot do? To help direct the dialogue, it can also be good to have your bot start the dialogue with a question. For example, if it’s a sports trivia bot, you can begin by asking “Hey, did you see the football game last night?” or “who is your favorite team?” Remember, with this kind of bot, there is very little information for the user to rely on for context. So you can give the user some clue about its purpose by starting with a question.

Vary the responses

We humans have a curious way of expressing the same idea in a multitude of different ways. Even a simple greeting can be spoken as “Hello”, “Hi”, “Hey”, or even “Howdy”! So to help your bot give better responses that feel more lifelike, it is a good idea to find ways to add some variance to how your bot responds to questions and other forms of input.

What’s next?

Well, chrisbot is here! He is still a little rough around the edges, but you can chat with him a bit. I need to work on his dialogue skills, and that’s where he needs to interact with more people. With more interaction to learn from, the better chrisbot becomes at, well, being a bot. I also need to decide on his purpose, which I intend to write a bit more about down the road.

Anyway, it would be great to get more people to interact with chrisbot. If you would like to ask him some questions, all you have to do is send a text to (650) 866–8990. Say “Hello” or ask him if you should have that last piece of cake for dessert! Let me know how it goes on Twitter!

So I built a bot…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s