I want to ignore certain intents when filling a form. I looked at the documentation but using ignored_intents
key will only ignore the filling of a slot but not the intent altogether. So actions defined with that intent are still carried out. How to completely ignore intents when a form is active?
Hi @Bert
There is no configuration that would allow you to ignore all intents in a form that are not relevant in that form. That is because maybe the user wants to get out of the form (e.g. intent stop) and then you need to deal with that either through directly stopping the form or through asking whether they are sure that they want to stop. You do so by training unhappy path for your form like here Forms There is no way around training for those cases.
So my advice: Identify the intents that may occur during your slot and train rules and stories that handle this. You could even train a story with:
stories:
- story: User interrupts the form
steps:
- intent: request_restaurant
- action: restaurant_form
- active_loop: restaurant_form
or:
- intent: has_question
- intent: want_to_do_x
- intent: want_to_do_y
- action: utter_handle_this
- intent: stop
- action: action_deactivate_loop
- active_loop: null
In which utter_handle_this would be something like: “Sorry I first need to finish that form before I handle that request. Ask me again, if I have collected all data.”
Or: If the intent would be handled with one action then you can train a rule for every case and handle that intent in between with one action…
Hope that helps
Hi, idk if this is still relevant, but you could overwrite the run method of the form validation action and perform some logic there. It´s dirty but it works:
`Class FormValidation(FormValidationAction): def name(self) → Text: return nameidk
async def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict
) -> List[EventType]:
if tracker.latest_message.get("intent", {}).get("name") == "YOUR_INTENT":
dispatcher.utter_message(
text="Whatever u want here"
)
return [
ActiveLoop(None),
SlotSet(REQUESTED_SLOT, None),
]
return await super().run(dispatcher, tracker, domain)`
I’ve run into something similar before. One way I dealt with it was by using RulePolicy to block the intent from triggering any actions. I set up a rule that matched the intent I wanted to ignore and basically made it do nothing. Another option I’ve used is creating a custom action that checks for the intent and returns an empty response or skips over the usual action.
Thanks so much