Creating a Rasa project

Creating a rasa project is very simple, rasa gives you an inbuilt command to create a sample project for you. 

rasa init 

After executing this command successfully you will get a directory structure containing a list of files, you can check the created files by typing “ls -la” on your terminal. Working upon it, we will be able to train our rasa model to perform various tasks according to our requirements.

  • The nlu.yml file inside the “data” folder contains the various training data to extract Intents and Entities.
  • The stories.yml file inside the “data” folder contains the sample user stories for training the chatbot which rasa core will make use of it and predicts the next suitable action/response.
  • The config.yml file contains configuration relating to the Machine Learning pipeline using which a sentence will be preprocessed and used by the nlu and core model.
  • The domain.yml file contains list of Intents, Entities, Responses and Actions, each of these things should be listed in the domain file. 
  • The actions.py file inside the actions folder contains various python functions for each custom action defined in the domain.yml file. This is a very useful file as it contains the action definitions which will be performed by the bot on specific intents, be it performing some calculations on the data, calling API’s and many more which a python function can perform.

The format of writing these files will automatically be provided by the sample project we create with the help of “rasa init”. We just have to add our own training data, list the intents, responses and write the required custom action and we are good to go.

We can train our model with the help of a simple command written below:

rasa train

After the model is trained we can test our model in the terminal itself through a simple command provided below:

rasa shell 

With this, we can start the conversation with the bot and tests our trained model. We can also use the –debug flag to see the various parameters such as the confidence, intents detected, next response, entities captured, etc, these will help us know the insights of the model and can further train the model in a better way to get more accurate responses.

How to send Custom Json Response from Rasa Chatbot’s Custom Action?

Rasa is an open-source Machine Learning framework to automate contextual text-voice-based Assistant. Rasa NLU understands the correct Intent with the help of its pre-trained nlu data. Rasa Core decides what to do next and reply according to in sync with the training stories. It also has the capability to store Entities (Noun type-specific Information stored for future use).  By default, it can respond with texts, image links, button objects etc.

Similar Reads

Installation

To get started with your own contextual assistant, just simply install Rasa with the help of below mentioned command:...

Creating a Rasa project

Creating a rasa project is very simple, rasa gives you an inbuilt command to create a sample project for you....

Custom Actions

Rasa provides its user with a lot of capabilities, it can perform any task just by writing a python class with some methods to fulfill the requirements. These functions are written in the actions.py file. Each function is attached with a specific action name starting with the “action_” keyword which should be mentioned accurately in the domain.yml file as well as in the user stories written in the stories.yml file. This custom action is triggered after a specific intent is captured by the nlu, it will perform the coded tasks and then will return the required responses....

Retrieve stored Entities inside the custom action method

Let’s see the below command which will help us to retrieve the stored entities present inside the local bot memory:...

Sending Custom JSON Response

Normally a bot sends a text message (string) as a response (Refer to the above-given screenshot) but the challenge comes when we have to send some custom response in the form of JSON data to satisfy the needs of the end-users of the bot....

Contact Us