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
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
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
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:
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
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:
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
- 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.