Using Haystack with Rasa for Better Conversational AI

Combine Rasa and Haystack to take chatbots to the next Level.

Rasa is an open source framework that brings conversational AI to the fingertips of any Python developer. Rasa makes use of the latest natural language processing (NLP) technologies to endow chatbots with the capacity to understand language and manage dialogue. 

Rasa provides ready-to-use NLP solutions, allowing developers to focus on high-level conversational design without getting into the nitty-gritty of machine learning model implementation. Once you build your chatbot, deploying it to a website, social media channel, or a chat application could not be simpler — Rasa comes with built-in integrations for the most common technologies like Facebook Messenger, WhatsApp, and Slack, to name just a few.

Thanks to advances in NLP, chatbots have seen great advances in terms of understanding and generating natural language. These days, many companies successfully employ conversational agents to provide customers with support and self-service options. AI-powered chatbots are increasingly finding novel applications even in previously unconventional industries like healthcare and banking. Unlike a human agent, a smart chatbot is available 24/7 to provide immediate feedback and assist users in completing routine tasks. 

Chatbots work with a mechanism called intent classification. Their built-in machine learning module recognizes an intent in a user’s request and triggers the appropriate response. However, to avoid frustration on the user’s side, it is crucial that the chatbot avoid misclassifying intent. For this reason, most chatbots have a mechanism for handling complex or undefined requests. They might, for example, hand the case over to a human agent or simply print out a message saying that they are unable to handle the request.

Frequently asked questions

  • When a user messages a chatbot, the chatbot classifies the message for its intent and the presence of entities. For instance, when a customer writes, "I’d like to order a pizza," the chatbot detects the message's intent as "make_order" and its entity as “pizza.” According to the detected intent and entity, the chatbot subsequently answers with, “What kind of pizza would you like?”

  • Various chatbot components, including those for entity extraction and intent classification make use of machine learning models. Rasa offers a modular framework that ties these components together. The framework’s modularity allows you to plug in your own components (or those from Haystack!) as a REST API call and tailor the pipeline to perfectly fit your use case.

  • The first chatbots were simple programs based on rules for matching and substituting patterns in sentences. Back then, programmers had to define explicit rules to govern a chatbot’s responses. Modern-day chatbots employ a much more powerful technology: machine learning. Machine learning works by capturing statistical correlations between data points based on real conversations. By exposing a machine learning algorithm to a large enough dataset, the algorithm computes a model of a chatbot’s behavior based on probability. In comparison to rigid, user-defined rules, probabilistic models are much more powerful and allow chatbots to have natural, multilayered conversations — almost as if you were talking to a real person!