This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

Chitchat and FAQs

FAQ assistants are the simplest assistants to build and typically the first kind of assistant anyone builds. This page is a guide to the concepts and training data you need to handle non-contextual questions like FAQs and chitchat.

FAQs and chitchat are two cases where the conversational assistant responds with a fixed set of messages, and the assistant should always answer the same way, no matter what has happened previously in the conversation. For example, in the following conversation, every question can be asked at any point in the conversation, with the answer being independent of anything the user has said previously.

User: What's your name

Bot: My name is Sara!

User: Which languages can I build assistants in?

Bot: You can use Rasa to build assistants in any language you want!

User: What’s Rasa X?

Bot: Rasa X is a tool to learn from real conversations and improve your assistant.


Step-by-step Guide on Using Response Selector for FAQs and Chitchat

To handle FAQs and chitchat you'll need a rule-based dialogue management policy (the RulePolicy) and an easy way to return the appropriate response for a question (the ResponseSelector).

1. Updating the configuration

For FAQs and chitchat, you always want the assistant to respond the same way every time the same type of question is asked. Rules allow you to do exactly that. To use rules, the you need to add the RulePolicy to your policies in your configuration file:

# other policies
- name: RulePolicy

Next, include the ResponseSelector in your NLU pipeline in your configuration file. The ResponseSelector requires a featurizer and intent classifier to work, so it should come after these components in your pipeline, for example:

- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 100

By default, the ResponseSelector will build a single retrieval model for all retrieval intents. To retrieve responses for FAQs and chitchat separately, use multiple ResponseSelector components and specify the retrieval_intent key:

# Other components
- name: ResponseSelector
epochs: 100
retrieval_intent: faq
- name: ResponseSelector
epochs: 100
retrieval_intent: chitchat

2. Defining Retrieval Intents and the ResponseSelector

Consider an example where you have 20 different FAQs. Although each question is represented as an individual intent, all FAQ intents are handled the same way in the dialogue. For each FAQ intent, the assistant retrieves the proper response depending on which question has been asked.

Instead of writing 20 rules, you can use a single action, e.g. utter_faq to handle all FAQs with a single rule by grouping them together under a single retrieval intent called e.g. faq.

The single action uses the output of the ResponseSelector to return the correct response for the specific FAQ that the user asked.

3. Creating rules

You need to write only one rule for each retrieval intent. All intents grouped under that retrieval intent will then be handled the same way. The action name starts with utter_ and ends with the retrieval intent's name. Write rules for responding to FAQs and chitchat:

- rule: respond to FAQs
- intent: faq
- action: utter_faq
- rule: respond to chitchat
- intent: chitchat
- action: utter_chitchat

The actions utter_faq and utter_chitchat will use the ResponseSelector's prediction to return the actual response message.

4. Updating the NLU Training Data

NLU training examples for the ResponseSelector look the same as regular training examples, except that their names must refer to the retrieval intent they are grouped under:

- intent: chitchat/ask_name
examples: |
- What is your name?
- May I know your name?
- What do people call you?
- Do you have a name for yourself?
- intent: chitchat/ask_weather
examples: |
- What's the weather like today?
- Does it look sunny outside today?
- Oh, do you mind checking the weather for me please?
- I like sunny days in Berlin.

Be sure to update your domain file to include the added chitchat intent:

# other intents
- chitchat

5. Defining the responses

Responses for the ResponseSelector follow the same naming convention as retrieval intents. Besides this, they can have all the characteristics of normal bot response. For the chitchat intents listed above, our responses could look like:

- image: ""
text: Hello, my name is Retrieval Bot.
- text: I am called Retrieval Bot!
- text: Oh, it does look sunny right now in Berlin.
image: ""
- text: I am not sure of the whole week but I can see the sun is out today.


Once you've done the following, you can train your bot and try it out!

  • Add RulePolicy to your policies and ResponseSelector to your pipeline in config.yml
  • Add at least one rule for responding to FAQs/chitchat
  • Add examples for your FAQs/chitchat intents
  • Add responses for your FAQs/chitchat intents
  • Update the intents in your domain

Now, your assistant should be able to respond correctly and consistently to FAQs or chitchat, even if these interjections happen while your assistant is helping the user with another task.