Hello everyone!
After updating the version of rasa from 1.6.1 to version 1.7.0, a FormAction stopped working. The function of this FormAction is to ask for the phone number, which is an entity and to ask for the name of the phone’s display, which is a free text slot. This works perfectly in version 1.6.1 of rasa.
Here is my FormAction
actions.py
class SolicitarConfiguracaoPersonalizacaoRamalForm(FormAction):
def name(self):
return "solicitar_configuracao_personalizacao_ramal_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["entidade_numeros_ramal", "nome_visor"]
def request_next_slot(self, dispatcher, tracker, domain):
for slot in self.required_slots(tracker):
if self._should_request_slot(tracker, slot):
if slot == 'nome_visor':
dispatcher.utter_template('utter_nome_visor', tracker)
if slot == 'entidade_numeros_ramal':
dispatcher.utter_template('utter_entidade_numeros_ramal_personalizar_ramal', tracker)
return [SlotSet(REQUESTED_SLOT, slot)]
return None
def validate(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]:
slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
if slot_to_fill == 'nome_visor':
return [SlotSet(slot_to_fill, tracker.latest_message['text'])]
else:
slot_values = self.extract_other_slots(dispatcher, tracker, domain)
if slot_to_fill:
slot_values.update(self.extract_requested_slot(dispatcher, tracker, domain))
if not slot_values:
raise ActionExecutionRejection(
self.name(),
f"Failed to extract slot {slot_to_fill} with action {self.name()}",
)
logger.debug(f"Validating extracted slots: {slot_values}")
return self.validate_slots(slot_values, dispatcher, tracker, domain)
def slot_mappings(self):
return {
"visor_ramal": self.from_text(),
"entidade_numeros_ramal": self.from_entity(entity="entidade_numeros_ramal")
}
def submit(self,dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]:
dispatcher.utter_message('Aguarde um instate. Estou personalizando o display do ramal.')
ramal = tracker.get_slot('entidade_numeros_ramal')
nome_display = tracker.get_slot('nome_visor')
Here is the image of the error that is presented, when the FormAction is triggered. He complains about the line return self.validate_slots(slot_values, dispatcher, tracker, domain)
I checked the rasa_sdk/forms.py file for versions 1.6.1 and 1.7.0, and identified that the await method exists in version 1.7.0, which did not exist in version 1.6.1.
Could someone on the team help me?