Entity with similar values (numerical value)


my question here is I was trying out OTP verification using FormAction, But here I am facing an issue that both the entity of number and OTP is in Numerical format, just the difference is in the length (Number - 10 and OTP - 4 ) but every time I enter OTP it goes to the NUMBER intent and not the OTP intent, is there any solution for this.

In DIalogflow we can achieve this by Followup Intents or even using Context, how do we do that in Rasa? Does RASA have something like Followup Intents?


The best equivalent to do something like followup intents in Rasa are Forms. It sounds like this is what you’re trying, so you’re on the right track.

To make the FormAction fill the “otp” slot when a “number” entity was extracted, you need to define slot_mappings (see here). A dictionary entry like

"otp" : [self.from_entity(entity="otp"), self.from_entity(entity="number")]

should do the trick.

In addition, you can also “help” Rasa to extract the OTP as an “otp” entity instead of “number” entity. If you know that the OTP will always have 10 digits, you can add a Regex for it to your training data.

## regex:OTP
- [0-9]{10}

With that regex and some examples where the OTP is marked as “otp” entity in your nlu training data for intent:inform, Rasa should learn to pick 10-digit numbers up as “otp” rather than “number”.

Imagine I have a form where both values are numerical for the first entity (phone_number) the length of the numerical value is 10 and for the second entity (OTP) the numerical value is 4 digit value.

now I am facing an issue in this.

Hope you understood the Problem

Did you try the solutions I suggested? If yes, what happened, does the problem still persist?

What does your form look like? Are the phone number and OTP separate slots that are asked for?

Did you find the solution to this? I am also stuck on this part in my bot and if you did find a solution can you please share it.