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.
NLU-based assistants
This section refers to building NLU-based assistants. If you are working with Conversational AI with Language Models (CALM), this content may not apply to you.
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.
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:
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:
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:
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:
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:
Be sure to update your domain file to include the added chitchat
intent:
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:
Summary
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.