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.
Contact Us