How to loop from filling if incorrect input is given

Working Scenario:

Case 1:

bot: asking the user to enter plant name.

user: user entered “neem”.

bot: correct output

Case 2:

bot: asking the user to enter plant name.

user: user entered “neeem”.

bot: display suggestion button: “neem” using spell checker model

user: user clicks on the suggested button

bot: no results found

Case Study: Actually, in our scenario, we are asking the user to enter the plant name using forms with a custom action, so when the user typed the correct name it shows the correct output (i.e. solt filled with the correct plant name).

But, (i.e. in case 2) when the user typed the wrong plant names… we are displaying the suggestion buttons with the help of the spell checker model (i.e. spello mode), so when the user clicks the suggestion button, it is not looping the form with a custom action and filling the slot name with the wrong plant name… so in this case after correcting the wrong spelling we are not able to display correct result.

can we keep conditions in the form to execute the multiple actions when the user enters the correct case and the wrong case? Because the correct case is executing but the wrong case we are not able to write a rule for another custom action.

here is my screenshot of the form rule for reference

Screenshot

The Simplest way to accomplish this is to put the import method in loop.

Can you provide more details (maybe the code) on how you are filling the slot and how slot validation is done?

Here are the references for you to understand it better @rasa_learner

nlu.yml

domain.yml

rules.yml

rulesfile

actions.py file

case1: correct input

case1

case2: wrong input & displaying suggestion button

case2

Hope the above references are enough to understand the scenario.

so based on rules.yml the 1st case is able to execute when we give the correct input.

But in 2nd case, if we give the wrong input, it displays the suggestion button & resets the slot/deactivates the form. so when the user clicks the suggestion button then it should give the correct input submission functionality without asking the plant name again. (i.e. 1st case input submission.)

But what’s happening is when the user clicks the suggested button we are not getting the correct output as case 1.

After the line,

ValidateBuyerForm.submit(…)

in,

return {“plantlist” : plantname}

the plantlist slot is being filled irrespective of the conditions of the submit method.

In the else case in submit method,

“payload”: correctstr

is not the slot_vlaue of “plantlist”. It is a new payload and it is not being utilized during the current validation.

In this part,

  Did you mean buyer
  1. neem (/corrected_info_buy) - {“text”: “neem”}

you can change the payload as,

  Did you mean buyer
  1. ‘/corrected_info_buy{“plantlist”: “neem”}’

and then have a slot validation.

You can then use

rasa interactive

to check whether slot filling and slot validation are done properly.

1 Like