In our first part “Rasa Introduction” we have seen the basic concept of Rasa. If you have not read the “Rasa Introduction” Blog then go through it before we start with Rasa X.
What is Rasa X?
Rasa X has been launched to further help developers working with Rasa open source framework. Rasa X is used to review the conversations between users and the assistant and using that to improve the assistant.
In this tutorial, we will see how to create intent, responses, stories and how can you train the model using Rasa X UI.
Before creating Rasa Project make sure you are in the directory “rasaDemo”.
To create a rasa project run the following command:
rasa init --no-prompt
Train a Model
Train your model using the below command.
rasa train
Talk to your Assistant
Once the model is trained successfully, you can test it using the below command.
rasa X
When you execute the above command a new tab will be opened in your browser automatically as shown in the below image, select the “Load Your assistant into Rasa X”.
Now click on the Menu from the left-hand side and select the “Talk to your bot” option.
Now test the bot, you can say “hello” or “hi” to start the conversation as shown below.
Intent & Training Phrases
Let’s see how can we create New Intent and add training phrases through Rasa X. From the left side, select NLU training from the Training Menu as shown in the figure.
Now select Training Data as shown below.
After selecting training data you can see “sentences” i.e the training phrases and their corresponding Intent.
You can create new intent by clicking on the “+” button on the right side, then from the intent dropdown select the “create intent” option as shown below.
Now provide your training phrase and the intent name which you want to create after that click on the save button as shown below.
You can even add multiple training phrases, for that click again on the “+” button, provide the training phrase and select the intent from the dropdown for which you want to add the training phrase.
Responses
You can add the bot responses from responses menu. Select the response menu as shown below.
To create a new response click on the “+” button from the right side as shown below.
Now from the dropdown select the “create new” option to create the template i.e the response.
Provide the response name and the response message which you want to provide to the end-users, then save the response. Once you save it, you can find this newly created response in the response.
Stories
Stories are example of end-to-end conversations. Story has the structure where we have the user message and how our assistant will respond to those messages. We can also say that stories contain the flow of conversation. To create a story first select the stories from the menu as shown below.
Now click on the “+” button and select the “create new story” option to create a new story.
Now write your story, with double hashtag ‘##’ provide the story name, provide the intent name with ‘*’, and then the bot response with ‘-’. Create the conversation flow according to your preference. Then click on the “save” button to save the story.
Once you have saved the story you can see the Flow of the story on your screen as shown below.
Train the Model
Now let’s again train the model. To Train the model select “Train” button from the menu as shown below.
Once the training completes, you can check the newly added details from the “Talk to your bot” option from the menu, select that as shown below.
Once you select the “talk to your bot” option, you may find the below like screen, that there is no active model. If this happens then click on the “View models” button.
When you click on “view models” button you will find the below like screen. It is the model menu, where all your models will be saved, you need to make the model active to use it. To make the model activate click on the “…” three dots button, then select “Make active” option, doing this your recently created model will be activated.
Now again click on the “talk to your bot” option from the menu. Say “hi” or “hello” to start the conversation and test your bot.
Hope this tutorial was helpful to you get started with Rasa X. Do let us know your feedback or queries in comment.
Feel free to comment your doubts/questions. We would be glad to help you.
Pragnakalp Techlabs: Your trusted partner in Python, AI, NLP, Generative AI, ML, and Automation. Our skilled experts have successfully delivered robust solutions to satisfied clients, driving innovation and success.