Skip to content

Commit

Permalink
Added settings key to SkillData
Browse files Browse the repository at this point in the history
  • Loading branch information
YuukanOO committed Dec 13, 2018
1 parent 867f37e commit 2eb5100
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
10 changes: 5 additions & 5 deletions NEXT.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Coming next
===

- [x] Support markdown in the answer and ask `text` property and automatically add a `raw_text` property containing the text without formatting (same goes for cards properties)
- [ ] Add a meta() for skills to define skill metadata, this will be pretty useful to query available skills and their needed configurations (need some more keys such as configs)
- [ ] Add support for **contexts** with sub intents
- [ ] Remote training of the interpreter for when you have large training data and you are deploying pytlas on a small device
- [ ] Introduce a `pytlas.settings` namespace which will handle all global settings used by skills. It will read settings from a configuration file and environment variables (should replace `pytlas.cli.conf`)
- [x] Defer all loadings (training and localization) by storing only a function handler and calling it at runtime. It will make easy to add dynamic trainings at runtime (such as available rooms or devices needed in training entities)
- [x] Support markdown in the answer and ask `text` property and automatically add a `raw_text` property containing the text without formatting (same goes for cards properties)
- [x] Add a meta() for skills to define skill metadata, this will be pretty useful to query available skills and their needed settings
- [x] Add `require_input` in the `agent.done` method to indicates that a skill has done its work but the client should listen to user inputs right now (it will be useful when working with contexts)
- [x] Updated snips-nlu dependency
- [x] Add `skills` args to `fit_from_skill_data` to restrict which training data should be loaded
- [x] You can now use a `pytlas.conf` file and it will be read by the cli in the current working directory
- [ ] Introduce a `pytlas.settings` namespace which will handle all global settings used by skills. It will read settings from a configuration file and environment variables (should replace `pytlas.cli.conf`)
- [x] Defer all loadings (training and localization) by storing only a function handler and calling it at runtime. It will make easy to add dynamic trainings at runtime (such as available rooms or devices needed in training entities)
- [x] Skills manager
- [ ] Remote training of the interpreter for when you have large training data and you are deploying pytlas on a small device
10 changes: 9 additions & 1 deletion example/skills/weather/weather.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
from pytlas import intent, training, translations, Card
from pytlas import intent, training, translations, meta, Card
from datetime import datetime
from dateutil.parser import parse as dateParse
import requests, pytz

@meta()
def register(_): return {
'name': _('weather'),
'description': _('Gives weather forecasts using the OpenWeather API'),
'version': '1.0.0',
'settings': ['OPENWEATHER_APPID', 'OPENWEATHER_UNITS']
}

# This entity will be shared among training data since it's not language specific
locations = """
@[location]
Expand Down
4 changes: 3 additions & 1 deletion pytlas/skill_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ class SkillData:
"""

def __init__(self, package, name=None, description='No description provided',
version='?.?.?', author='', homepage='', media=''):
version='?.?.?', author='', homepage='', media='', settings=[]):
self.package = package
self.name = name or package
self.media = media
self.description = description
self.version = version
self.author = author
self.homepage = homepage
self.settings = settings

def __str__(self):
return """{name} - v{version}
description: {description}
homepage: {homepage}
author: {author}
package: {package}
settings: {settings}
""".format(**self.__dict__)
7 changes: 5 additions & 2 deletions tests/test_skill_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
TEST_VERSION = '1.1.0'
TEST_AUTHOR = 'Julien LEICHER'
TEST_HOMEPAGE = 'https://julien.leicher.me'
TEST_SETTINGS = ['A_SETTING']

class TestSkillData:

Expand All @@ -22,11 +23,13 @@ def test_it_should_print_correctly(self):
description=TEST_DESCRIPTION,
version=TEST_VERSION,
homepage=TEST_HOMEPAGE,
author=TEST_AUTHOR)
author=TEST_AUTHOR,
settings=TEST_SETTINGS)

expect(str(data)).to.equal("""%s - v%s
description: %s
homepage: %s
author: %s
package: %s
""" % (TEST_NAME, TEST_VERSION, TEST_DESCRIPTION, TEST_HOMEPAGE, TEST_AUTHOR, TEST_PACKAGE))
settings: %s
""" % (TEST_NAME, TEST_VERSION, TEST_DESCRIPTION, TEST_HOMEPAGE, TEST_AUTHOR, TEST_PACKAGE, TEST_SETTINGS))

0 comments on commit 2eb5100

Please sign in to comment.