Hermes Python

Hermes Python allows you to interface seamlessly with the Snips platform and kick start the development of voice applications.

Hermes Python abstracts away the connection to the MQTT bus and the parsing of incoming and outgoing messages from and to the components of the Snips platform.

Basic Usage

Hermes Python has two ways to interact with the MQTT bus :

  • By sending messages to the Dialogue Manager

  • By subscribing callbacks to events triggered by the Dialogue Manager

Hermes Python can be installed on your system with: pip install hermes-python

Here's a basic code to connect to a distant device running the Snips platform, that listens to any incoming intents, that prints them out.

from import Hermes
MQTT_ADDR = "localhost:1883" # Specify host and port for the MQTT broker
def subscribe_weather_forecast_callback(hermes, intent_message): # Defining callback functions to handle an intent that asks for the weather.
print("Parsed intent : {}".format(intent_message.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
# We get out of the with block, which closes and releases the connection.

Next Steps

Now that you have a basic comprehension of how Hermes Python work, we invite you to check the full documentation in Hermes Python documentation. Make sure to check: