Time for us to talk: Padatious, Conversation, Context and Fallbacks
This release provides many new tools and techniques for Skills to implement more conversational interaction with speakers.
FEATURE: Conversational support for skills. (#925)
The most recently used skills now have an opportunity to preview all utterances before they hit the intent system. Skills remain "active" for 5 minutes after last use. Active skills get a preview in the order of activation -- most recent first -- and if they can consume the utterance or ignore it. If consumed, processing stops. If ignored, the next most recent skill gets a shot at it. Finally, if no skill consumes it the intent system takes over running as usual.
A skill achieves this by implementing the converse() method, e.g.
def def converse(self, utterances, lang="en-us"):
if .... :
return True # handled, consume utterance
else:
return False # not for this skill, pass it along
Thanks JarbasAI!
FEATURE: Padatious, an examples based intent system (#939)
Padatious is an alternative mechanism to Adapt for defining intent handlers. Rather than defining explicit vocabulary and structures, you provide example sentences.
__init__.py:
from mycroft.skills.core import MycroftSkill
class TomatoSkill(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('what.is.intent')
def handle_what_is(self, message):
self.speak('A tomato is a big red thing')
@intent_file_handler('do.you.like.intent')
def handle_do_you_like(self, message):
tomato_type = message.get('type')
if tomato_type is not None:
self.speak("Well, I'm not sure if I like " + tomato_type + " tomatoes.")
else:
self.speak('Of course I like tomatoes!')
vocab/en-us/what.is.intent:
What would you say a tomato is?
What's a tomato?
Describe a tomato.
What defines a tomato?
vocab/en-us/do.you.like.intent:
Are you fond of tomatoes?
Do you like tomatoes?
What are your thoughts on tomatoes?
Are you fond of {type} tomatoes?
Do you like {type} tomatoes?
What are your thoughts on {type} tomatoes?
FEATURE: Skill Context manager (#934)
Adding a basic context system. This allows conversations where a skill can get information from previous interactions. This includes:
- Creating an intent handler which includes a requirement for a context when registered. This context can then be provided by other intent handlers using the
self.add_context()
method. (See examples below) - Injecting context such as location or time for other skills to use. This provides the possibility to have conversations like this
Hey Mycroft, what's the time in London
10:42
Right, what's the weather over there?
Rain with a temperature of 14 degrees C'''
The Context manager will by default remember 3 entries back and with a time limit of 2 minutes.
See PR #934 for more details.
FEATURE: Intent multi-fallback system (#938)
This new system now allows multiple skills to register as fallbacks for utterances that weren't caught by conversation or explicit intent handlers. This includes general knowledge skills -- such as Wikipedia or IMDB -- as well as more creative things like AIML. Fallbacks are executed in self-defined priority order until one claims to have handled the utterance.
By default Mycroft now falls back to Wolfram for general knowledge queries and AIML to provide personality. Such as:
Hey Mycroft, I'm tired
Better get some rest
Skills implement this by registering and defining a handle_fallback() method.
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
See PR #938 for more details.
FIXES
- ISSUE #958 - Make visime stream end together with audio
- ISSUE #969 - Audio service doesn't log audio service messages
- Fixed naming of file for wake-word recording/debugging mechanism Thanks @reginaneon! (#971)
- ISSUE #978 - PulseAudio integration could have muting issue in rare circumstances
- ISSUE #982 - Fix # core calculation issue for Mimic CPU. Thanks @el-tocino! (#983)
New/Updated APIs:
- Add mycroft.util.download.download(url, dest, complete_action=None). If specified, complete_action function will be called once the download is complete. (#990)
- The .build() is no longer necessary when defining intents (#996)
Misc
- Extensions to developer setup tools:
- MSM cleanup: (#973, #972)
- Improve help message, documenting all options. Thanks @el-tocino!
- Make the DEFAULT_SKILLS list readable (wrapped lines)
- Prefix messages with ERROR or WARNING
- Cache list of skills (instead of hitting web repeatedly)
- Improve format of output messages
- Sort skills from 'list' and 'search' commands
- Return result codes (was always 0)
- Modified return codes, they can't be > 255. 301 and 303 are now 201 and 203
- Add DeviceAPI.is_subscriber() to query for user account status. (#991)
- Testing enhancements (#840):
- Add messagebus testing
- Add test/skills/integrationtest framework to support self-testing of skills. More to come soon!