XBlock Highlights: Chatbot XBlock
This article was written by team member Kshitij Sobti
One of the strengths of Open edX is its support for plugins called XBlocks that enable the creation of rich new kinds of content. Through XBlocks the Open edX platform can support interactive content that greatly expands the platform’s capabilities. XBlocks have been used for all kinds of things, from adding a simple border around some content, to adding support for LTI to the platform. OpenCraft has had the opportunity to work on and create some great XBlocks, and we’ll be taking a look at one of them in this post.
The Chatbot XBlock is perhaps one of the smaller and lesser known of the blocks we have developed, but we hope this highlight will bring to the attention of more people. The Chatbot XBlock describes itself as “an XBlock that allows learners to chat with a bot, where the bot follows a script and the learner can choose among possible responses.“
The block is presented to students as a chat conversation with an interface that mimics the visual language of chat applications with bubbles of text pointing at different avatars. Students can pick from a number of pre-written responses. The simulated conversation will flow based on what response a student selects.
At a basic level the block allows you to create conversations by breaking them down into a series of individual interactions, or steps. Each interaction or step will support one or more messages along with select responses. If there are no responses, the conversation will automatically move on to the next step. If there are responses, the user can select one of them and the conversation will branch accordingly.
Conversation from the bot side can also include images, and feedback notes that can tell the user if their response was correct or not.
Course authors can use a a simple YAML-based syntax, to design complex, branching conversation with students which they can use to explore a subject in a more interactive way. For example, in a History course, a bot named “Churchill” asks a learner a few questions about World War II, and provides different pieces of information depending on the learner’s answers.
The syntax for designing these conversations supports a number of features that allow the conversation to seem more natural, and to split, merge and loop back if needed. For example, the syntax allows a number of more advanced features such as:
- Multiple personas for bots: The syntax allows creating multiple bot personas with different names and avatar images. This can allow you to include multiple tones, and make it feel even more like a conversation.
- Randomized messages: You can specify a number of potential messages, and the block will automatically, randomly select one of the messages. This can be useful in making the conversation feel less repetitive, by including multiple variants of the same message.
Currently, the only way to design these steps is through a special YAML-based syntax, however it follows a pretty straightforward format that should be easy to read and write. Here is a sample that uses most of the features (note any text following a # symbol is a comment):
The chat block can be a pretty useful tool in introducing concepts, asking questions, or giving feedback that are better done in a conversational format.
You can find out more about the Chatbot XBlock, and get a detailed overview of the syntax by visiting its repository on GitHub.
We can also install the XBlock for you and provide support as needed. Write to us at email@example.com if you have any questions!