I’m creating a survey bot in Rasa and I’d like it to trigger a function in the actions.py file when it receives a response on one of the form slots. I tried following the instructions for the
extract_ slot method in the documentation, but something isn’t working. Here is my code from the domain and actions (the function in actions that it should trigger is
list_tasks_numbered_names when the experience_dose slot is filled).
So long as I fill the appropriate intents, the form continues filling the slots, but it just doesn’t trigger anything in actions.py
Thank you and please let me know if I can make this question more clear
class ValidateExperienceForm(FormValidationAction): def name(self) -> Text: print ('experiece form triggered') return "validate_experience_form" async def required_slots( self, slots_mapped_in_domain: List[Text], dispatcher: "CollectingDispatcher", tracker: "Tracker", domain: "DomainDict", ) -> Optional[List[Text]]: required_slots = slots_mapped_in_domain return required_slots async def extract_experience_dose( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict ) -> Dict[Text, Any]: print ('experiece form triggered under async') text_of_last_user_message = tracker.latest_message.get("text") tasklist = list_tasks_numbered_names(text_of_last_user_message) #tasklist = '"' + tasklist + '"' resp = "Here is your task list: \n"+str(tasklist) print ('DEBUG: this is the task list', tasklist) #dispatcher.utter_message('here is a list of tasks to choose from', tasklist) dispatcher.utter_message(resp) return [SlotSet('experience_dose', tasklist)]
experience_form: required_slots: experience_substance: - type: from_text not_intent: bogusintent value: false experience_dose: - type: from_text not_intent: bogusintent value: true experience_insight: - type: from_text intent: inform value: true