Taking user input to correct extracted entities

Is there a way to allow the user to correct extracted entity values? Here’s an example flow of conversation:

bot: Please tell me what type of cuisine you're interested in.
human: I want some Vietnamese food.
bot: You want {} food, is that correct? (bot failed to extract entity)
human: No, I want *Vietnamese* food.
bot: ...

I want the user to be able to double check the entity values that Rasa bot extracts and correct the value if it’s wrong. Based on my understanding, the form validation actions can check extracted slot values to see if they’re valid. But this is validation from the perspective of the bot. What I’m looking for is validation from the human.

I trawled through documentation and searched the forums but couldn’t find anything obvious. The best that I could come up with is to write specific stories to validate each extracted slot value. However, there are two downsides to this approach. One is that if I want to validate multiple slot values at once (to make the conversation flow more natural), then the branching factor is 2^{number_of_slot_values_to_be_validated}. The other downside is that if the bot extracted the wrong entity value the first time, then obviously I can’t use the existing mechanism to try to extract it again because it would still get it wrong.

Does Rasa have any built-in mechanisms to allow for human validation?

You want {} food, is that correct?

In this example, you don’t need to ask the user because you already know the value is null and you need to prompt the user for a valid value.

The form validate function should validate the cuisine slot. If it’s not valid, then it should specifically ask for the cuisine.

Here’s an example validating a slot called priority and the bot will re-prompt the user until a valid value is entered.

Thanks @stephens . You’re right that in this case the bot’s validation action would have caught the None value itself and would have re-prompted the user. I should have used a better example. What I’m looking for is for the human to double validate what the bot extracted. Let me try to give a better example:

bot: Please tell me what type of cuisine you're interested in.
human: I want a pepperoni pizza.
bot: You want pizza, is that correct?
human: No, I want a *pepperoni* pizza.
bot: ...

From the bot’s perspective, it extracted and validated the entity correctly. But the extraction is suboptimal because of lack in training data. I’d like to give the human the chance to correct the bot. Is there such a functionality in Rasa?

You can have something like,

You want pizza, is that correct?


     Yes /intent{'cuisine': 'something'}

     No /intent{'cuisine': None}

If the user presses ‘No’, then the cuisine slot is none and with stories you can again ask the user to provide the cuisine type.

@rasa_learner - yes, I’m aware of that mechanism. But there are a couple of problems with that approach. One is that I have to write extra stories, and the more entities I want the user to validate, the more stories I need to write. The branching factor is 2^{num_entities_to_validate}, which adds to the complexity of the bot. This is more of an inconvenience than a deal breaker. But the second downside of this approach is that if what Rasa extracted the first time was wrong, then that means the training data was insufficient, which means that I should probably not use the same mechanism the second time around, because it’ll still get it wrong, and that will cause further user frustration, which I want to avoid. So, to make sure that I get it right the second time around, I need to set up a different mechanism. The best I can think of is via another slot that is mapped straight from text. Something like this in domain.yml:

    type: text
    - type: from_entity
      entity: cuisine
  # a separate slot used to correct cuisine in case it wasn't extracted properly the first time
    type: text
    - type: from_text

But this seems very complicated. I’m wondering if there’s an easier way. It seems like a natural thing to want to do. So I was wondering if Rasa already has a mechanism for doing so, and I just didn’t find it.