Is it possible to tell RASA (NLU) the possible classes to predict?

Viewed 72

I am having a very special problem with my chatbot application: Not all the classes used for training are available all the time. Use case: Imagine being in an e commerce system and you have a class for cancelling your purchase. But this is only possible if you have not yet cancelled it. In this case I want to say to RASA: Well, take anything except it's "cancellation", because it's not possible to handle that prediction.

Through that I hope to enhance the accuracy of my chatbot's prediction as it's less wrong classes it could choose.

Anyone having an idea if RASA directly supports such use cases? Or do I have to implement it myself after prediction time?

Thank you :)

1 Answers

This isn't possible out of the box. There are two different ways of handling this:

Either you build a custom component to influence prediction or choose a different prediction.

Take a look at where your system is failing, and try to address that. It seems to me that you probably have similar intents related to cancellation, and would like to predict one or the other depending on whether cancellation is possible or not. However, Rasa's intent classification is independent of context. You could make the bot responses or actions dependent on context, like so:

rules
 - rule: initiate cancellation
   condition:
   - slot_was_set:
     - open_order: true
   steps:
    - intent: cancel
    - action: initiate_cancellation
 - rule: deny cancellation
   condition:
   - slot_was_set:
     - open_order: false
   steps:
    - intent: cancel
    - action: utter_no_open_orders
Related