Library for creating voice assistant skills for the hermes skill server (hss-server)
Project description
HSS - Skill
Library for creating skills based on the Hermes Skill Server.
Installation
Simply use pip
:
pip3 install hss_skill
Overview
The hss_skill
package contains tools for fast and easy development of skills for the Hermes Skill Server. The goal is to let skill developers only care about their own skill implementation, while the internal stuff (communication with the skill-server, reading configuration, etc) is provided out-of-the-box by the hss_skill
package.
The package provides a base class for skills BaseSkill
which does all the incovenient stuff, like communication with the skill server, reading configuration file etc.
Abstract methods
When developing skills, a subclass of BaseSkill
must be implemented, which overwrites two abstract methods:
get_intentlist
- shall return a list of intents handled by your skillhandle
- the actual entry point for handling intents of your skill
Done-method
In addition, BaseSkill
provides the done
-method, which should be called after the intent has been fully handled. This method also allows to send response-messages, which will then be forwarded to the TTS of your voice assistant. This function has the following signature:
done(session_id, site_id, intent_name, response_message, lang)
Parameter explanation:
session_id
- same as provided by thehandle
methodsite_id
- same as provided by thehandle
methodintent_name
- same as provided by thehandle
methodresponse_message
- optional: your message which shall be sent to the TTSlang
- optional: language code which will be passed as well to the TTS (defaults toen_GB
)
main.py
Skills must provide the file main.py
, which is the file the skill-server is going to run. This file should create an instance of your skill class, and then call the run
method of the skill.
Configuration
hss_skill
automatically read a configuration file config.ini
if it is present in your skills root-folder. The configuration will be provided to the skill-class via self.config
.
Dependencies
Further dependencies can be defined in the file requirements.txt
which should at least contain the dependency to hss_skill
.
Example
A minimum example of using hss_skill
. The folder contents might look like:
main.py
myskill.py
config.ini
requirements.txt
main.py
import myskill
if __name__ == "__main__":
skill = myskill.WeatherSkill()
skill.run()
myskill.py
from hss_skill import hss
class WeatherSkill(hss.BaseSkill):
def __init__(self):
super().__init__() # important, call super's constructor
def get_intentlist(self):
return ["howAreYou"]
def handle(self, request, session_id, site_id, intent_name, slots):
return self.done(session_id, site_id, intent_name, "Thanks, I am fine")
requirements.txt
hss_skill>=0.1.2
certifi
geopy>=1.20.0
requests>=2.22.0
Skill installation
Please refer to Hermes Skill Server.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hss_skill-0.2.0.tar.gz
.
File metadata
- Download URL: hss_skill-0.2.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e577d6c7deff01f63955465c63b02f27b94f193bb877a2df79b72688da29e45 |
|
MD5 | 6ef7f6a9f727bd32a25debf68d78aa80 |
|
BLAKE2b-256 | ffa05da59ec9cec7333da03555eadd16ae6b4289e62848b19689bcf9399bbd89 |
File details
Details for the file hss_skill-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: hss_skill-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c097626a5d81b07a19b2d37942561cbc9ba6fc4748ea03489306a36ef50b4a96 |
|
MD5 | e13e0f4acf1f13e15889e281a89ae7a8 |
|
BLAKE2b-256 | f63781db40ad12ddf9a84c917612cea48c6ee76859909d7308401ec76eb62a5b |