What is Rasa:

In simple terms, Rasa is an open-source platform used to build conversational assistants that can be deployed anywhere. Rasa provides Rasa X tool that can be used to build complete chatbots using a graphical interface(GUI).

You can check the installation guides for Rasa and RasaX for running them in your environment.

Rasa X: 

Rasa X helps us to learn from real conversations with the help of a graphical user interface. It is a tool designed to make it easier to Build, Improve and deploy assistants by learning from real conversations.

Rasa X is packed with new UI features which allow you to:

  • View and annotate conversations: You can review and fix conversations that didn’t work as expected with your users.
  • Get feedback: You can share your assistant with real-world users and get immediate feedback and training data

Getting Started:

Before we start with building our chatbot lets take a look at some fundamentals

  • Intent: Consider it as the aim or target of user input. Suppose If a user says, “Which month is tomorrow?”, the intent would be finding the month.
  • Entity: It is the information or an item from the user input that can be extracted for further operations. If we consider the previous example, we can understand the target is to find the month of a particular day, but we do not know of which day yet. If we can extract “Tomorrow” as an entity here, we can then find the month of “Tomorrow”.
  • Actions: As the name suggests, it is an action performed by the bot be it replying to something, parsing a database, triggering an API etc.(in our case here responses)
  • Stories: These are the interactions between a user and the bot. Stories can otherwise be defined as intents captured and actions performed. Using these Stories a developer can code what to based on user inputs. Like when a question is asked by a user and you could not extract all intents & entities accordingly.

Creating a Rasa agent:

Creating intents: 

  1. After you log in to rasa x in the left side panel, below training, select NLU training and click the ‘+’ icon in Annotate new data.
  2. Now add any possible user query and click enter.
  3. Now in the text box beside it, give the new intent name and click on ‘create {intent name}’ in the dropdown and mark it as correct.
  4. We suggest to follow this pattern while choosing intent name convention, eg: ‘SmatBot.pricing’ where SmatBot is a product/service name and pricing is the intent.

Adding responses: 

  1. Once you create a new intent head over to responses and click the ‘+’ button.
  2. In the first text field give the utterance name, eg: utter_SmatBot.pricing and corresponding response in the second text field. 

Creating a story: 

  1. Now let’s map intent with a response. Head over to stories and click on the ‘+’ button.
  2. Use below syntax for creating a story and click on save.

 # {story name}

* “intent name”

      – “utterance name”

Adding entities:

  1. To add entities, you need to double click on the word in training data query you added.
  2. Now, in the dialogue box, type in the entity name and click ‘create{entity name}’ in the dropdown.

Example: 

Here, let’s say for example you need to train your agent for answering pricing related questions.

Users can ask it with many different synonyms like cost, expense etc. First, create an entity named ‘pricing’ and You can add cost, expense in the training data and mark them as synonyms for your entity ‘pricing’.

Note: You should create at least 2 or more samples for intent mapping, 2 or more responses for an utterance, 2 or more samples for an entity mapping. 

In the same way, you can create multiple intents, corresponding responses, stories and entities. This makes the bot more diverse with multiple FAQ’s.

Training and Activating Model: 

  1. Once you add all the intents, responses, stories and entities in your agent click on ‘train’.
  2. After the completion of training head over to the models and activate the latest trained model by clicking on the three dots shown in the below image.

Note: This step is Mandatory after changes done to the agent. Else, your agent will be working on the previously activated model.

Deploying your rasa agent.

Now there are multiple ways to deploy your rasa agent. A simple google search can help you find multiple ways to deploy it for your users. Also, You can check out this link for connecting your Rasa chatbot to SmatBot chatbot platform.

 

Comments

comments