Intro
Coming from a longer discussion in rhasspy’s issue tracker, I’d like to share a prototype for a hermes-based skill server application I’ve made a month ago. Its called hss-server
(Hermes Skill Server), and allows for easy intent handling implementation and management.
I’ve started development on this as some kind of replication of the snips-skill-server
, since I had a working voice assistant already for the snips.ai platform, which now is dead. It follows similar design principles, and aims to provide a stupidly easy to use programming interface, CLI and configuration.
In short, hss-server
is meant to be a system service/daemon which is hosting third-party intent handlers (“skills”), and connects to MQTT to receive hermes protocol messages. hss-server
talks to individual skill instances via RPC, and each skill is running as separate process with its own python virtual environment. Currently, all this is done in python
, however there have been discussions on allowing other technologies as well.
To develop skills for the hss-server
, I’ve provided a client library hss-skill
, which needs as little as 2 methods to be implemented for a working skill.
Repositories for the server and the client library are available here and here, together with detailed setup instructions and guidelines.
Example
A minimal working example of a skill cool look like:
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")
The installation of the server could be as easy as:
/home/s710 $> mkdir hss
/home/s710 $> cd hss
/home/s710/hss $> mkdir hss
/home/s710/hss $> python3.7 -m venv /home/s710/hss/venv
/home/s710/hss $> source venv/bin/activate
(venv) /home/s710/hss $> pip install hss_server
Features
When starting the server, it is going to load all installed skills and connect to MQTT:
(venv) /home/s710/hss $> hss-server
INFO:hss: Hermes Skill Server v1.0.0
INFO:hss: Using config dir '/home/s710/.config/hss_server'
INFO:hss: Loading skills from '/home/s710/.config/skills'
INFO:hss_server.skillserver: Loading skills ...
INFO:hss_server.collection: Initializing skills ...
INFO:hss_server.collection: Skill 'hss-skill-s710-weather' loaded
INFO:hss_server.collection: Loaded 1 skill
INFO:hss_server.skillserver: Connecting to MQTT server ...
INFO:hss_server.mqtt: Connected to 10.0.50.5:1883
INFO:hss_server.mqtt: Publishing TTS to topic 'hermes/tts/say'
INFO:hss_server.mqtt: Subscribing to topic 'hermes/intent/#' ...
A CLI tool hss-cli
is provided to easily install and update skills:
(venv) pi@calypso:~/hss/venv $ hss-cli -l
--------------------------------------------------------------------------------
Skill Version Commit Date Config
--------------------------------------------------------------------------------
hss-s710-weather - 2ff87ec 05/06/2020, 07:00:18 y
(venv) pi@calypso:~/hss/venv $ hss-cli -u
Updating ALL skills. Continue? (YES|no)
Updating skill 'hss-s710-weather' ...
Skill 'hss-s710-weather' successfully updated.
1 Skills updated, 0 skills without update
Roadmap
Currently, hss-server
is based on my usage of the version 2.4 of rhasspy, and thus does not yet cover the whole hermes dialog functionality. This is currently in the works and will be available during the next few days.
In addition, ideas of providing a list of skills which are available for installation (“marketplace”) and automatic injection of training sentences is under discussion.
Thats it for now, as this is only a very short intro, I’ll probably complement more info later