Creating a live chatbot for your website (Part 2): Modifying, training and testing your chatbot using Rasa X

Obianuju Okafor
Chatbots Life
Published in
5 min readMay 5, 2021

--

Screen capture from my website

Hello! Welcome to the second part of a 3-part series involving creating and deploying a chatbot for your business or personal website using Rasa, Docker and Heroku. In the first part, I spoke about setting up the chatbot locally on your system and making changes to it using a text editor. In this second part, I will be talking about how to make changes to your chatbot using the platform Rasa X. I will teach you how to add new data, train your bot and use the newly generated model to talk to your chatbot, all through Rasa X.

Rasa X is a Conversation-Driven Development (CDD) tool that helps you improve your chatbot. Rasa X provides a user interface for you to interact with your bot. With Rasa X, you can chat with your local chatbot as an end-user, you can also enter new data and retrain your chatbot.

To install Rasa X, do the following:

  1. Open Anaconda prompt and cd into your Rasa project directory (created in the first part of this series).
Anaconda Prompt Terminal

2. Activate the virtual environment you created in the last part of this series.

conda activate rasavirtualenv

3. Install Rasa X by running the command below

pip install rasa-x --extra-index-url https://pypi.rasa.com/simple

You might have to downgrade pip if installation is taking too long

pip install — upgrade pip==20.2

Once Rasa X has been successfully installed, run the command below

rasa x

This command will pop up a user interface in your browser. In this user interface you are going to see several tabs. In this tutorial I will be focusing on the Nlu data, Responses, Stories, Models, Talk to your bot tab, and Train button.

Rasa X User Interface

NLU Data Tab

This where you enter training data for the user. The training data here are sample messages that the user could potentially send to the chatbot. This corresponds to the nlu.yml file on your local system. When you enter a new message you also have to classify the intent, this helps the chatbot predict what the meaning behind a user’s message is when it receives a similar message in future.

NLU Data Tab

In the image above you can see that I entered a new message ‘Hola’ and I classified the intent as ‘greet’. After entering this information, I will save it. You can enter as many examples as you would like, the more the better. You can also create new intents.

Responses Tab

This is where you enter sample responses for the chatbot i.e. the messages the chatbot should send back to the user when it receives any message. Similar to the NLU data tab, each response is categorized according to intent; for example, ‘utter_greet’ encompasses the responses the chatbot should give to the user when it receives a message with intent ‘greet’. You can enter new responses by selecting a response category and clicking on the plus button. When you enter a new response variant, you simply press ‘Save’. You can also create new response categories.

Responses Tab

Stories Tab

This corresponds to the stories.yml file in your local file directory. This is where you bring the data from the two previous tabs together. Here you are basically creating a storyline or a plot, where depending on the intent of the message sent by the user, the chatbot has to give an appropriate response. This helps teach the chatbot what to do in different scenarios. For example, if the chatbot receives a message with intent ‘greet’ it has to respond by sending a greeting back to the user through the action ‘utter_greet’.

You need create as many stories as possible. You should have a happy path/storyline i.e. where things go as planned. You also need to have a sad path/storyline which handles the exceptions. You can create a new story by clicking on the plus button.

Train Button

When you are done entering all your new data in the NLU data, Responses and Stories tab, you need to press the Train button, this button will retrain your chatbot and save the newly generated model in the Models tab. The great thing about Rasa X is that when you train your chatbot, all the new data you entered is also entered and stored locally in the corresponding files on your local system.

Models tab

This where you can find all your generated models. The most current model is always the one at the top. You can activate this model by clicking on the up arrow.

Models Tab

Chat with your bot Tab

Once you have activated the new model, you can test it out in the Chat with your bot tab. As you can see in the image below, the response the bot gave is the new response I entered earlier.

Chat with your bot tab

There you have it! This is how to enter new data, train and test your chatbot using Rasa X. In the next part of this series I will be talking about how to deploy your chatbot on a live server Heroku using Docker, and also how to communicate with this bot through a chat widget in your website. You can find that post here.

If you like this post, HIT Buy me a coffee! Thanks for reading.

Your small contribution will encourage me to create more content like this.

Don’t forget to give us your 👏 !

--

--

Computer Science PhD Candidate. Research areas: Human Computer Interaction, Software Engineering, Accessibility, Machine Learning & Natural Language Processing.