Guest post by XinYue Microsoft Student Partner at Oxford University
Hi I’m Xinyue. I study computer science and psychology at Brown University, and am currently a visiting student at Oxford. Interested in illustration, graphical arts and writing, I hope to combine human-centered design with technology.
Introduction to Bot Framework
Ever want to have a conversation with a virtual bot, which greets you, “understands” what you say, and do tasks for you?
This tutorial introduces you to the Bot Framework, examples of good interactive designs, and how to apply those ideas when you start building your own bot. The framework executes your code and formulates the resulting I/O, thus the user can interact with it through various supported platforms, such as Skype and Office 365 mail.
For this example I will be using the Bot Builder SDK from github
The README file contains instructions for installation, and inside CSharp-Samples, you can view examples, with each bot having a specific functionality.
Design and Implementation
Before delving into the building process, we firstly define our goal. In general, there are two types of interactive agents, the first mimics human response to make the conversation as natural as possible, while the other helps with efficiency, assisting with mechanical tasks in a clear and concise manner, such as displaying weather forecast for a specific region after you ask it weather and provide a location. Since we do not use natural language processing, let’s focus on the latter for now.
Here are some principles to keep in mind:
Asking restrictedly-themed and closed-end questions are highly recommended!
You might ask: Why not make the bot “human” to converse spontaneously, since it’s an AI? We want to let the bot be helpful, instead of pretending to be human. It is practical to convey what it can do and what it needs to know to users from the very beginning, otherwise, when the natural language input cannot be recognized, the user will soon get frustrated when the bot slows down the task he or she wants to execute due to repeated “I don’t understand.”
We can achieve this by offering options, see example below for a pizza bot:
To make it more interactive, we may turn the option list into control buttons, so that users simply click on them to complete orders.
However, a functional bot is not confined to monotony. We may also use different utterances to convey the same functionality with enums. Take greetings as an easy example:
To personalize the bot, we may extract sentiments from user input, assign them polarities (positive, negative, neutral) denoted by numerical values, and then produce output accordingly.
For instance, a restaurant-recommending bot may process and store user’s opinion about each restaurant at the back-end and using them as basis for recommendation.
The code above is in Python, but you can convert it into other languages using the same logic. But I cannot wait until I can use my favourite language Python to build a bot.
When creating such interactions that collect user data such as names, locations and preferences, one thing to keep in mind is user privacy. Please always include an explanation or disclaimer to inform the user, preferably with a pair of accept/decline button.
The above are design ideas I wish to share. For a fundamental walk-through and further applications, such as using Azure Bot Service and LUIS, can be found on sites below: