How can I do the slot values correction if the user give the wrong information and want to make the correction again while filling the form? Which action should I need to do for my assistant?
hi @minnie - welcome to the forum! Coudl you please share an example conversation with the behaviour you want to achieve?
thanks!
I write custom action in action in actions.py like the following:
class ChangeSlotValue(Action):
def name(self):
return "action_change_value"
def run(self, dispatcher, tracker, domain):
if tracker.latest_message['intent'].get('name') == "value_correction":
if tracker.latest_message['entities'][0]['entity'] == "digits":
defined_slot = tracker.get_slot('num_people')
if defined_slot is not None:
defined_slot = None
slot_value = tracker.latest_message['entities'][0]['value']
dispatcher.utter_message("The value is changed!")
return [SlotSet('num_people', slot_value)]
but it doesn’t work and always call default fall back action when I try with the intent “value_correction” including the entity “digits”. In the actions.py I also defined form action class, so two action class are in actions.py.
In form action class:
"num_people": [self.from_entity(entity = "digits"), self.from_text(not_intent = "value_correction")],
I also defined ‘not_intent = value_correction’.
The following is one of the stories I have defined in stories.md:
## very unhappy path
* greet
- utter_greet
* booking
- restaurant_form
- form{"name": "restaurant_form"}
* explore_restaurant
- utter_answer_restaurant
- restaurant_form
* value_correction
- action_change_value
- restaurant_form
* value_correction
- action_change_value
- restaurant_form
- form{"name": null}
- utter_confirm_booking
* affirm
- utter_accept_booking
* thank
- utter_thank
actions.py (4.8 KB)
Thank you!
I need help! Is there an option to temporarily pause the form?
hi @minnie - sorry for the slow response. If the form cannot extract a slot value from the * value_correction
input, then it should fire a ActionExecutionRejected
event and the action_change_value
action should be getting predicted.
Can you please show the output of running through this conversation with rasa shell --debug
?
Thank you for the reply! I tried it in another way. I found that if ‘value_correction’ is detected, the entity value from the user message is automatically updated.
For example: I have already filled restaurant name in the first question for the form. In another question, if I input ‘value_correction’ intent with the entity restaurant name I want to make correction, it automatically updated the entity value. I found it unconditionally and now I think it solves if we try to extract according to the entity we found in user message. It can update when the same entity type is found and confirm the newer entity value.
@amn41 Hi, how to fire ActionExecutionRejected
event through the code?
docs on that are here