Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add intent fallback system #938

Merged
merged 5 commits into from Aug 8, 2017
Merged

Add intent fallback system #938

merged 5 commits into from Aug 8, 2017

Conversation

MatthewScholefield
Copy link
Contributor

This is the same pull request from 3 weeks ago, but with skill-wolfram-alpha blacklisted and a new fallback-wolfram-alpha added to the default skills. Note: since Wolfram's API key is currently not working, we this cannot be tested.

Original description:
This is a new system that allows other skills to register as fallbacks to handle general knowledge queries. For now, each skill self-assigns a priority where 0 is the highest and 100 is very low priority. When an intent failure occurs, each fallback gets run until one returns True meaning it found a response to speak to the user. Example usage:

skill-my-fallback/__init__.py:

from mycroft.skills.core import MycroftSkill
class MyFallbackSkilll(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self, name="MyFallbackSkill")

    def initialize(self):
        self.register_fallback(self.handle_fallback, 80)

    def handle_fallback(self, message):
        if 'what is' in message.data['utterance']:
            self.speak_dialog('the answer is always 42')
            return True
        return False

This PR also removes the multi utterance intent fail. It only makes sense to emit an intent_failure regardless of the amount of intents, especially since we only ever receive one utterance anymore.

When testing, check functionality of Wolfram Alpha for questions like what is a fox (and maybe wolfram skill reloading when /opt/mycroft/skill-wolfram-alpha/init.py is edited).

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 41.339% when pulling 4db6539 on feature/fallbacks into e1a1751 on dev.

@forslund
Copy link
Collaborator

forslund commented Aug 2, 2017

Looks extremely good. Unfortunately wolfram alpha seems to be unavailable to me right now so I haven't been able to test it.

Also PR 145 on mycroft-skills (MycroftAI/mycroft-skills#145) need to be merged before this one.

Would like to verify it with a working wolfram alpha before merging.

Also removes multi utterence intent fail. Only makes sense to emit an intent_failure regardless of the amount of intents
This makes it more concise and mimics the behavior of self, but for static methods
This is necessary because of the API breaking change
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 41.221% when pulling fee8ffa on feature/fallbacks into 4c1fbcb on dev.

@forslund forslund merged commit ab22106 into dev Aug 8, 2017
@MatthewScholefield MatthewScholefield deleted the feature/fallbacks branch September 15, 2017 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants