Responses

Responses

If you want your assistant to respond to user messages, you need to manage these responses. In the training data for your bot, your stories, you specify the actions your bot should execute. These actions can use responses to send messages back to the user.

There are three ways to manage these responses:

  1. Responses are normally stored in your domain file, see here
  2. Retrieval action responses are part of the training data, see here
  3. You can also create a custom NLG service to generate responses, see here

Including the responses in the domain

The default format is to include the responses in your domain file. This file then contains references to all your custom actions, available entities, slots and intents.

intents:
 - greet
 - default
 - goodbye
 - affirm
 - thank_you
 - change_bank_details
 - simple
 - hello
 - why
 - next_intent

entities:
 - name

slots:
  name:
    type: text

responses:
  utter_greet:
    - text: "hey there {name}!"
  utter_channel:
    - text: "this is a default channel"
    - text: "you're talking to me on slack!"
  utter_goodbye:
    - text: "goodbye 😢"
    - text: "bye bye 😢"
  utter_default:
    - text: "sorry, I didn't get that, can you rephrase it?"

In this example domain file, the section responses contains the responses the assistant uses to send messages to the user.

Note: If you want to change the text, or any other part of the bots response, you need to retrain the assistant before these changes will be picked up.

Creating your own NLG service for bot responses

Retraining the bot just to change the text copy can be suboptimal for some workflows. That’s why Core also allows you to outsource the response generation and separate it from the dialogue learning.

The assistant will still learn to predict actions and to react to user input based on past dialogues, but the responses it sends back to the user are generated outside of Rasa Core.

Proactively Reaching Out to the User with External Events

You may want to proactively reach out to the user, for example to display the output of a long running background operation or notify the user of an external event.