Handling unexpected input from user while a form is running is mentioned in rasa docs here- Handling Unexpected Input
However, it only works when there is just one response back to the user and the form continues. I can’t figure out a way to handle an unexpected input, when resolving it requires multiple to and fro messages. This is because requested_slot
in the active form is not null
and hence any message sent by the bot is always followed by a message asking for the requested_slot
value.
Is there a way that asking for filling the next slot can be delayed for some time?
For example, here is the example of handling unexpected input in the rasa docs
- story: number of people interjection
steps:
- intent: request_restaurant
- action: restaurant_form
- active_loop: restaurant_form
- slot_was_set:
- requested_slot: num_people
- intent: explain
- action: utter_explain_num_people
- action: restaurant_form
After the explain
intent, I am designing a situation where the bot is responding as you can either tell me now or when you arrive. Do you want to tell now?
, using the intent tell_now_or_later
. The user responds with intents yes
or no
. If yes
is received, the form will continue or else it will not.
When I create the story for the yes case like this, it doesn’t work as it’s asking for the requested_slot
immediately after tell_now_or_later
- story: number of people interjection
steps:
- intent: request_restaurant
- action: restaurant_form
- active_loop: restaurant_form
- slot_was_set:
- requested_slot: num_people
- intent: explain
- action: tell_now_or_later
- intent: yes
- action: restaurant_form
Any idea how to resolve this?
Hi @shalabhsingh ! This is strange. It should work as expected. Two suggestions:
-
You can try out the formbot example (rasa/examples/formbot at main · RasaHQ/rasa · GitHub). The stories over there resemble almost exactly to what you want to do. I just tried it out and it works perfectly there.
-
What does your configuration look like? Specifically for TEDPolicy
.
Hi @dakshvar22, thanks for your reply.
My policy looks like this-
policies:
- name: AugmentedMemoizationPolicy
max_history: 3
- name: TEDPolicy
max_history: 5
epochs: 20
constrain_similarities: true
- name: RulePolicy
I will try out the formbot as well and respond back here. I think my issue might well be because of conflict with some other stories (a rule/story is getting higher precedence over this one). Is there any way to check which stories are being considered by rasa and the selection process? I tried rasa shell --debug
but didn’t help.