Chatbot Development

Building Bots with the Rasa Framework

With a sophisticated NLU engine that can power contextual AI assistants over text or voice, Rasa is a chatbot framework to consider for more ambitious projects. Unlike many bot frameworks, Rasa is also open source. A developer community provides NLU training models, bot prototypes, and guidance.

August 15, 2019
tools building chatbot on rasa stack framework

In a virtual assistant landscape that’s ripe for innovation, the Rasa bot framework is carving out a niche for itself. The primary goal behind Rasa is to help developers build AI-powered voice and text assistants. With today’s bot-building frameworks, that might sound rather ordinary, but Rasa is doing something a little bit different.

According to Rasa Technologies, the company behind the product, the framework makes it possible to build contextual chatbots—true AI assistants that do more than recite responses to FAQs. In other words, Rasa wants to make your bots more sophisticated and less bot-like.

What is Rasa?

Rasa is an open source chatbot framework that began as a project on GitHub. Since its genesis in 2016, the company has moved from Berlin to San Francisco and refined its mission as an AI-focused bot-building toolkit. Rasa even raised $13 million in venture capital funds.

Using Rasa, developers have the option to build locally with on-premises tools or to build bots in the cloud. Since the product is laser-focused on contextual AI, you’re most likely to turn to Rasa for more ambitious projects, like bots that can process highly nuanced utterances and return highly nuanced responses.

That being said, the barrier to entry is low. You can start using the framework for free, so there’s little risk in exploring the Rasa documentation to get a feel for it.

You may know Rasa by its previous name, the Rasa Stack, which was used to describe the different components of the Rasa chatbot framework until earlier this year. The company has since dropped “Stack” from its name in favor of a simpler (and perhaps more brandable) moniker.

To be clear, you’re still getting a full stack of bot-building tools when you use Rasa. When it was known as the Rasa Stack, there were separate libraries for Rasa NLU, the framework’s natural language understanding component, and Rasa Core, which is the dialogue engine. Now, these two components coexist under the Rasa umbrella, although you can still use Rasa NLU on its own, if you prefer.

Rasa chatbot examples

Teams use Rasa to build highly sophisticated text and voice assistants for a variety of platforms, including proprietary applications. Let’s explore a few examples of Rasa-built chatbots.

Business analytics chatbot

SHIBA is a chatbot that functions as a data analyst. An acronym for Slack-Hosted Interface for Business Analytics, SHIBA locates, aggregates, and visualizes data from conversations being held on Slack.

A Rebellion Warwick product, SHIBA engages business decision-makers in conversations about how users interact with their products—for example, video games—and about the comments those users make about their experiences. SHIBA relies on the Rasa NLU engine for entity extraction.

To understand how SHIBA works, imagine someone at Radiant Warwick needs information about when and where a game is being played. One could also inquire about specific aspects of gameplay and how players are faring. Ultimately, users can draw from SHIBA’s data to make decisions about game development.

Image search chatbot

One well-known brand that uses Rasa for NLU is Adobe. With its AI assistant for Adobe Stock (powered by Adobe Sensei), Adobe helps users find the right stock images based on highly specific parameters.

For example, if a user needs a picture of a man doing yoga, they can use voice commands to tell the bot that’s what they want to see. The user can further refine their search by telling the bot to show just pictures that were taken outside, images with a green background, and so forth.

Healthcare chatbot

Tia is a HIPAA-compliant chatbot that allows women to ask private, health-related questions. The goal behind the bot, which was built with input from a team of women’s health professionals, is to provide women with a trustworthy health advisor who helps them make informed decisions about their sexual and reproductive health.

Developers built Tia using the Rasa NLU. Users can ask questions about their health concerns or even list out specific symptoms to get insights about next steps. Given that many of these conversations are personal, HIPAA compliance is paramount. Rasa’s architecture makes it possible to meet HIPAA standards. Since developers can run every backend process on-premises using Rasa, there’s no point at which a user’s private health information is at risk. Furthermore, developers can integrate Rasa with the existing infrastructure that’s known to be HIPAA compliant.

Why use Rasa? The pros and cons

Rasa pros

The most significant advantages of Rasa are its sophisticated NLU engine and the open source community that helps power it. If you’re poised to build a chatbot capable of processing complex and highly subtle user utterances, whether via text or voice, Rasa is a framework you’d be smart to consider. And, since it’s free, you can dive in and see whether it works for you.

Other advantages include the option to build and run your bot on-premises, which could be a deal-breaker for heavily regulated industries. We’ve already explored how the on-premises option is useful in healthcare, but it can also be valuable for financial companies and other organizations that process sensitive consumer data.

Since Rasa is open source, you also get to see and work with all of the underlying machine learning components. Not that you necessarily have to—open source natural language processing (NLP) libraries can give you a significant head start.

Rasa cons

If there’s any downside to Rasa’s sophistication, it might be the sophistication itself. As some critics have noted, Rasa isn’t necessarily for beginners. Unless you’ve built chatbots before, Rasa’s machine learning tools might strike you as a bit intimidating. Consider using a third-party application, like Rasa UI, Rasa Talk, or Articulate, which put a GUI in front of Rasa NLU.

Another potential drawback has to do with computer memory. spaCy, one of Rasa’s default pipelines for processing user inputs, uses a lot of it. Depending on your server configuration, spaCy could slow down other processes.

Rasa features and integrations

Rasa NLU is probably the framework’s most celebrated component. It goes beyond rule-based training and delivers true machine learning that can improve your bot’s performance over time. The ability to deploy Rasa pretty much anywhere (locally or in the cloud) offers additional flexibility that many organizations appreciate. Since the product is open source, you can also piggyback off of existing language models and fine-tune them for your purposes, accelerating your development timeline.

Integrations abound, and Rasa’s documentation shows you how to integrate your bot with communication channels such as:

  • Facebook Messenger
  • Slack
  • Telegram
  • Twilio
  • Cisco Webex Teams
  • Rocket.Chat
  • Mattermost

Want to run Rasa in conjunction with another framework? Rasa has a channel connector script for the Microsoft Bot Framework, in case you want to combine some of Rasa’s capabilities with those offered by Microsoft.

Perhaps the most valuable integration tutorial is the one for deploying your bot to your own website. After all, keeping your bot on a specific domain ensures that users can find it—even if they’re not using a particular messaging app. You also have total control over your own domain, which isn’t the case with platforms like Facebook Messenger or Telegram. A .BOT domain name help users to identify your bot’s “home” and make it easy to bookmark your bot and return to it instantly.

Rasa pricing model

It costs nothing to use the open source framework or the Rasa X Community Edition and to benefit from its NLU, bot-building tools, channel connectors, and active developer community. To access more features, consider Rasa X Enterprise Edition, which is available as a paid subscription.

Intended for enterprise customers, Rasa X Enterprise Edition is a beefed up version of Rasa. You get extras like single sign-on, role-based access, bot analytics, and environments for development, staging, and production. You also get a service level agreement (SLA), which might be required at many larger organizations.

Rasa X Enterprise Edition is subject to a custom pricing model. If you think you need it, contact Rasa to work out an exclusive agreement.

Supported programming languages

Rasa NLU is written in Python, but you can use it even if Python isn’t your go-to language. For example, you can use Rasa NLU via a third-party platform, like Articulate. This allows you to manage dialogue through Rasa with minimal exposure to the backend. You can also fulfill responses using a different tool, such as another framework’s SDK for Node.js, PHP, or Ruby.

Rasa NLU is flexible enough to run this way. Essentially, you’d be using Rasa NLU for intent and entity matching and other tools for related processes.

Keep in mind that the documentation provides an extensive rundown of all the syntax you need to build a bot with Rasa, and it’s not as if you’re coding straight Python. As an example, consider the training data formats. You can provide it in Markdown, which is really straightforward and readable to pretty much anyone, or in a JSON format, if you’re more comfortable using that.

How machine learning works in Rasa

Machine learning in Rasa is pretty complex, but the fundamentals break down as follows:

  1. Using actual user interactions with your bot, create stories that teach your bot the proper responses to user inquiries.
  2. Create an NLU model via those stories. The stories, cumulatively, are the training examples that define your model.
  3. Train your NLU model through an accumulation of stories.

These steps incorporate all the usual NLU processes, such as identifying intents and extracting entities. You also need to configure a pipeline in Rasa. We mentioned spaCy earlier, and it’s one of the pipelines you can use to tokenize and vectorize your models. In fact, assuming you’ve got fewer than 1,000 training examples, you’ll probably be using spaCy.

How to get started with Rasa

Explore the documentation, and read through the tutorials. Be sure to familiarize yourself with the sections about Rasa NLU and Rasa Core so that you understand how the underlying components allow you to build highly capable virtual assistants.

The Rasa Getting Started Guide and the Rasa Community Forum are also excellent resources. Since Rasa is open source, there’s a veritable gold mine of information, discussions, NLU models, and more for you to explore.