Hope you have read the previous blog to create chatbot using Rasa. I would recommend to read it before starting this blog.
This blog will help you understand insights of rasa ecosystem and explain how to train your model effectively.
Rasa is an open source framework for creating chatbot with natural language undertsanding. There are few important files of rasa project -
This file contain information about intent and respective actions. For instance- basis on intent of a user, appropriate action gets triggered and response is sent back to user. '-utter' is plain text without any logic behind it, however we can create custom action which we will discuss further in the blog.
- text: Hey! How are you?
- text: 'Great, carry on!'
- text: Did that help you?
Custom action can be triggered by exposing it on some URL which you define in this file. One such example of action endpoint is shown here. This file also contains information about connecting to channels like facebook
This file contains information about nlu and core models.
Here details about connecting to other services is defined. For instance - slack, facebook and so on. For exposing chatbot as API, we have to uncomment 'rest' based settings. Read the previous blog to know more about how to expose chatbot as API and integrate it with website.
This file is used for defining user stories. One can define happy path or sad and link the appropriate action which needes to be triggered. We can define our own stories as well in this file.
## happy path
## sad path 1
## sad path 2
This file help to train your bot. If any response is incorrectly tagged, you can put it in right intent and retrain the model by using > rasa train command.
- good morning
- good evening
- hey there
- see you around
- see you later
- i love you
- of course
- that sounds good
Custom action is defined in this file. You can put the logic to decide what response should be returned. Infact, you can call an API in this file, perform action and return appropriate response.
from typing import Any, Text, Dict, List
#import the rasa dependencies
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
def name(self) -> Text:
|Flow of chatbot messages and model training|
If you are comfortable using commands, you can open the file on local machin, make the modifications, retrain the model and test it using CLI. If thats not the case, Rasa X library can make your life easy by providing a nice user interface.
How to install Rasa X?
1. Goto rasa_project directory
> pip install rasa-x --extra-index-url https://pypi.rasa.com/simple
2. Once installed, run this command -
> rasa x
It will open a nice website on local browser, see screenshot -
Hope the above blog helped you understande Rasa ecosystem and easy way to train the model.