Rasa Chatbot – A Powerful Chatbot Framework

Filed Under: Python Advanced

Hello readers! Well done on completing the intent classification task. In this article, let me introduce you to the Rasa chatbot framework. It is an NLU (Natural Language Understanding) framework. So let’s learn about it.

What is Rasa Chatbot?

Rasa is an open-source machine learning platform for creating AI assistants and chatbots.

In order to work in Rasa, you typically do not need any programming language experience.

What do AI Assistants do?

Two duties are performed by AI assistants: knowing the customer and providing the right answers.

The Rasa chatbot stack addresses these activities with the Rasa NLU portion of natural language interpretation and the Rasa Core component of conversation management.

It mainly performs two tasks:

  • Intent Recognition
  • Entity Extraction

There are two major modules in Rasa:

  • Rasa NLU for interface message comprehension
  • Rasa Core for discussing what to do in future

Rasa X is a platform that allows you to create, enhance, and deploy AI Assistants operated by the Rasa chatbot structure.

A web interface and a REST API are included with Rasa X. The newest update from Rasa is Rasa X.

Working with Rasa Chatbot

Let’s get right into installing the Rasa chatbot and then training our first model.

1. Install Rasa

Installing Rasa is super simple through the Anaconda suite. I’ve tried the other method through pip, but rechecking and installing dependencies will easily take up hours:

conda install python=3.6
conda create -n rasa python=3.6
source activate rasa
pip install rasa-x --extra-index-url https://pypi.rasa.com/simple

In Rasa, creating a new project is easy:

rasa init --no-prompt

You’ll now have a project folder, that will be ready to use with the following files:

  • __init__.py ⇒ an empty file that helps python find your actions
  • Actions.py ⇒ code for your custom actions
  • config.yml ‘*’ ⇒ configuration of your NLU and Core models
  • Credentials.yml ⇒ details for connecting to other services
  • data/nlu.md ‘*’ ⇒ your NLU training data
  • data/stories.md ‘*’ ⇒ your stories
  • domain.yml ‘*’ ⇒ your assistant’s domain
  • Endpoints.yml ⇒ details for connecting to channels like fb messenger
  • models/<timestamp>.tar.gz ⇒ your initial model

2. Train your Rasa Chatbot

As soon as we create the project, we will need to train the model first. This saves the model for further use. If you exit the virtualenv, then you’ll have to delete the project and create a new one.

rasa train

This will output the various hyperparameters that you can optimize, along with a progress bar.

We can now talk to our chatbot:

rasa shell
Rasa Shell
Rasa Shell

3. RasaX Graphical Interface

Similar to the above Rasa shell, I also spoke about a GUI service in Rasa called RasaX. It opens in our web browser as an interactive chatbot with icons and color:

Rasa X
Rasa X

4. Rasa Chatbot Backend

RasaX has two intent classifiers that we can choose from:

  • Intent Classifier Sklearn
  • Intent Classifier TensorFlow embedding

This works like the Intent Classification we performed in our previous tutorial: Retrieval-based Intent Classification in Chatbots 3/4

Ending Note

If you liked reading this article and want to read more, visit our homepage and check out all the latest articles!

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content