When using forms in Rasa, there is a method in the FormAction class where values other than the requested slot are extracted. It´s called extract_other_slots and it is invoked from the validate method(348-350):
#extract other slots that were not requested
#but set by corresponding entity or trigger intent mapping
slot_values = self.extract_other_slots(dispatcher, tracker, domain)
In extract_other_slots, the required slots are obtained and checked if they have to be filled. There are two checks to fill the slot - if the slot should be filled by entity or by trigger intent. The check if the slot should be filled by entity is the following:
//check whether the slot should be filled
// by entity with the same name
should_fill_entity_slot = (
other_slot_mapping[“type”] == “from_entity”
and other_slot_mapping.get(“entity”) == slot
and self.intent_is_desired(other_slot_mapping, tracker)
I didn´t understand why the slot is going to be filled only by entities with the same name. Why do not fill the slots from entities with different names?
The effect is:
- A form has a slot called “parameter” that is mapped to two entities - name or number
- The required slots are [parameter, confirmation]
- The user enters a number, the slot “parameter” is filled and the next requested slot is confirmation
- When the user is asked for confirmation, he/she changes his/her idea and enter a name.
- The active form is runned, it tries to fill the confirmation slot without success.
- The required slot at this point is “confirmation”. But the slot “parameter” is pointing to the old number. The form executes the method extract_other_slots, but does not update the “parameter” slot, because of the check above (the slot has to have the same name as the entity)
- The form asks for the confirmation to the user with the number instead of showing the name that the user entered.
I think this is a bug. But some people disagree.
What do you guys think?