Build an open future with us.

Invest in Mycroft and become a community partner.

Multiple @ decorators for single intent


#1

@KathyReid, @forslund,
I read a while ago (might have been in a pull request) that we can use multiple @intent_handler decorators to trigger a single intent.
Can you confirm that this is in-fact possible? If so are there any specific instructions on doing this or is it just as simple as adding a second @intent_handler decorator to the function? I can think of a couple use cases where this would be helpful.
Thanks,


#2

just add a second decorator, it will create two intents with same handler

i have done this before, i used adapt for strict matches that should have priority and also a padatious intent for some lose formulations


#3

That works, great. I also just discovered the “.one_of()” option for intents, that is very handy too. Wonder what other nuggets i have yet to discover.


#4

The Intent documentation is one I’ve been meaning to come back around on for months - big ups to @Jarbas_Ai for his handy blog post!