Python bindings for Snips Hermes Protocol
Project description
Hermes Python
The hermes-python
library provides python bindings for the Hermes protocol that snips components use to communicate together.
hermes-python
allows you to interface seamlessly with the Snips platform and quick start development of Voice applications.
hermes-python
abstracts away the connection to the MQTT bus and the parsing of incoming and outcoming messages from and to the components of the snips platform.
Installation
The library is packaged as a pre-compiled platform wheel, available on PyPi. It can be installed with :
pip install hermes-python
Or you can add it to your requirements.txt
file.
Requirements
The wheel is available for Python 2.7+ and Python 3.5
The wheel supports the following platform tags :
manylinux1_x86_64
armv7l
,armv6
macos
Usage
The lifecycle of a script using hermes-python
has the following steps :
- Initiating a connection to the MQTT broker
- Registering callback functions to handle incoming intent parsed by the snips platform
- Listening to incoming intents
- Closing the connection
Let's quickly dive into an example : Let's write an app for a Weather Assistant !
This code implies that you created a weather assistant using the snips Console, and that it has a searchWeatherForecast
intent.
Here is a code example for python2.7
:
from hermes_python.hermes import Hermes
MQTT_ADDR = "localhost:1883" # Specify host and port for the MQTT broker
def subscribe_weather_forecast_callback(hermes, intentMessage): # Defining callback functions to handle an intent that asks for the weather.
print("Parsed intent : {}".format(intentMessage.intent.intent_name))
with Hermes(MQTT_ADDR) as h: # Initialization of a connection to the MQTT broker
h.subscribe_intent("searchWeatherForecast", subscribe_weather_forecast_callback) \ # Registering callback functions to handle the searchWeatherForecast intent
.start()
# We get out of the with block, which closes and releases the connection.
Examples
Handling the intent_message
object
Coming soon.
Providing TTS feedback for a voice application
Coming soon.
Documentation
Hermes protocol documentation
If you want to dive deeper into how Snips components communicate together, check out the specification of the hermes-protocol
here.
You can also check this repository for other language bindings.
API
Coming soon.
Release Checklist
Everytime you need to perform a release, do the following steps :
- Commit all changes to the project for said release
- Write all the changes introduced in the Changelog (HISTORY.rst file) and commit it
- Run tests
- Bump the version and commit it
- Upload to PyPI
History
0.1.29 (2019-01-29)
- Fixes bug when deserializing
TimeIntervalValue
that used wrongencode
method instead ofdecode
.
0.1.28 (2019-01-14)
- Fixes bug when the
__exit__
method was called twice on theHermes
class. - Introduces two methods to the public api :
connect
anddisconnect
that should bring more flexibility
0.1.27 (2019-01-07)
- Fixed broken API introduced in
0.1.26
with the publish_continue_session method of the Hermes class. - Cast any string that goes in the mqtt_server_adress parameter in the constructor of the Hermes class to be a 8-bit string.
0.1.26 (2019-01-02)
- LICENSING : This wheel now has the same licenses as the parent project : APACHE-MIT.
- Subscription to not recognized intent messages is added to the API. You can now write your own callbacks to handle unrecognized intents.
- Adds send_intent_not_recognized flag to continue session : indicate whether the dialogue manager should handle non recognized intents by itself or sent them as an
IntentNotRecognizedMessage
for the client to handle.
0.1.25 (2018-12-13)
- Better error handling : Errors from wrapped C library throw a LibException with detailled errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for hermes_python-0.1.29-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecab986601301a2a251fafc1b191dbd2d8ca3ec76279464a68c96afa1de1d8b1 |
|
MD5 | c59e72175f0a7b1759527d8b8bdd4d20 |
|
BLAKE2b-256 | bac642086e0f393a982f96cd933acf2fbf17756aaa8f5507906e4c1236e7ba3d |
Hashes for hermes_python-0.1.29-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed9ea1d9eae668b6bf24a340fbb707c9a25aa621b8cbfa2cf20a8fa59554c33f |
|
MD5 | 2ec0be5cb523efe3ddb8e694b7478421 |
|
BLAKE2b-256 | 1ee8396c9c66f5ea69be6a8dac74bd804afe28bc5a2c454b69ac0c26486a1604 |
Hashes for hermes_python-0.1.29-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 693cc5453c370e169be88052bfeda36b9191faa1478b19a91f9fbcc648021195 |
|
MD5 | 2228b0eb7a03dd7428a85c30f6c18255 |
|
BLAKE2b-256 | 55475c84f083de3630c8bd48ccc3173c0435f96f58416b0c635dc2c1c478746d |
Hashes for hermes_python-0.1.29-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57be81f8af568b8ce5a97e1fd02f50dffd5f34c94517410707544601ff664ced |
|
MD5 | 0f6dc4a067055eeb958392bf113f43f2 |
|
BLAKE2b-256 | 3fd7a3c127f58d05fb5aa6329efb43d78d8017ec051aa1b0b7e85bca77562a48 |
Hashes for hermes_python-0.1.29-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abead6e6f32231c1b8d41c8714f13833a57d3f75b266a0ce650539b00ec3571c |
|
MD5 | c845dfe3b29693f8d57ce974e9ae8a44 |
|
BLAKE2b-256 | d24b1ca4055820f8035b97d8604ba8df673771baaacb6d2a410cd0f3389b86bb |
Hashes for hermes_python-0.1.29-cp35-cp35m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f37865b0caed18dad024e10c9a952fec328ff9ff5cc19035b69c39a2c11c42f |
|
MD5 | 68253f834f000e83afef161ace449386 |
|
BLAKE2b-256 | e49deb5db73db4d0c6bfac759dc5d6a075d9e40171941ee4b1dd65a8c4658169 |
Hashes for hermes_python-0.1.29-cp35-cp35m-linux_armv6l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef924626fbc314225cd62e014113d0c2f5185d382edd3fa1758e34a564267ccf |
|
MD5 | abbe8eedb92cabd71094f367ac636586 |
|
BLAKE2b-256 | 8f8d692e028833552513ed725fe16ef222317cb432bacc3e496abf0a542f0468 |
Hashes for hermes_python-0.1.29-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27806e2175dd04c41bcab4a515e3bce45dad451e23975dc6ae64d94575e5bde7 |
|
MD5 | 61ace0a1cdf1f7583d46d4b6182e5971 |
|
BLAKE2b-256 | 7b3b3291f3970a47b3c5635f0c738bc091bd5c532ed314249a004f1d2a214970 |
Hashes for hermes_python-0.1.29-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0565208a184ece94c1a89a474bb79c2ef7919dc2ccf8085230f75fa2c9c79eae |
|
MD5 | a4d3839b5532b878600defcc5953e45a |
|
BLAKE2b-256 | b5c46c50e0d0f3aa131206c9ad44126a17b1bd3ce3fddd5c91cfe94b2d027a63 |
Hashes for hermes_python-0.1.29-cp27-cp27mu-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ff63b7ec3806287b07a9da2efa5d0f4b385e3e78385486311bf96da1563c5f5 |
|
MD5 | b67b5b13491d094b91e2890585db3e6d |
|
BLAKE2b-256 | e84c1054114fb174c5aec3097460098710b2314a31802a8971ae7c5199609c40 |
Hashes for hermes_python-0.1.29-cp27-cp27mu-linux_armv6l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 849204e6e585daaaa7553d9cfb85370ce305d4a6f0876a5db81da923c6c2f141 |
|
MD5 | d10b0d5a520fe8ee44a10b070c758a64 |
|
BLAKE2b-256 | 3c843ff64d7518e6c883c2e06aeb4c81180e0e1a5945710d0fc57fdc15c6253c |
Hashes for hermes_python-0.1.29-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f15eb996e17b045ace5a3a07ab79b7f49d06460d31efc23dc0ce284c6c064ad0 |
|
MD5 | 85fbff1d3ecf69f2801b94786b17affb |
|
BLAKE2b-256 | 6a9b44398fbec625a15eca82cb8a48afe60b0f62026387ca4bb25c74627c9b42 |
Hashes for hermes_python-0.1.29-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2dcb18ba455e5d2730a339a2a4eca343290800e2089ac3115d27c84d67c56cc |
|
MD5 | b7f0d75b502817f8cd58537671d58f59 |
|
BLAKE2b-256 | bbe91a03ac9d9bf4b254196f735923241837eea2d669784037112a29c37cfacc |