I’m having difficulty calling different custom actions within the same form.
In a form with a series of slots to be filled, some slots call different custom actions. for example, when the slot is asking for a task name, it will call an API.
Then, when a different slot is requested, a custom function will extract the latest text and call a different API.
But, it’s not working.
I tried two different strategies in the action below.
I tried tracker.get_slot, but this triggered the custom action each time. I only wanted this if statement to be triggered on the latest slot requested, but it’s triggering it every time the validation form is run.
I tried validate_ within the validate_form, but this did not run the custom action I needed.
In the action below, you’ll see that when asana_task_name is requested, it should run an api call.
Then, when the next slot is requested, it should also call the action associated with the next slot.
how do I do this?
Thanks and let me know if I can clarify this question
class ValidateAsanaForm(FormValidationAction): def name(self) -> Text: return "validate_asana_form" def run( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> List[Dict]: """Create an incident and return details or if localmode return incident details as if incident was created """ def validate_asana_task_name( self, slot_value: Any, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict, ) -> Dict[Text, Any]: print ('validation run') if tracker.get_slot('asana_task_name'): print ('triggered asana task name') text_of_last_user_message = tracker.latest_message.get("text") print ('last user message', text_of_last_user_message) tasklist = list_tasks_numbered_names(text_of_last_user_message) resp = "Here is your task list: \n"+str(tasklist) print ('DEBUG: which task would you like to select from this list?', tasklist) dispatcher.utter_message(resp) return [SlotSet('asana_select_options_slot', tasklist)] else: pass if tracker.get_slot('asana_number_select'): print ('asana number select triggered') text_of_last_user_message = tracker.latest_message.get("text") print ('this the last text sent from number', text_of_last_user_message)