Skip to content

speechmatics/speechmatics-flow

Repository files navigation

speechmatics-flow

Python client library and CLI for Speechmatics' Flow Service API.

Getting started

To install from PyPI:

pip install speechmatics-flow

To install from source:

git clone https://github.com/speechmatics/speechmatics-flow
cd speechmatics-flow && python setup.py install

Windows users may need to run the install command with an extra flag:

python setup.py install --user

Instructions on how to create an account and generate an API key can be found here: https://docs.speechmatics.com/flow/getting-started#set-up

Example command-line usage

  • Setting URLs for connecting to flow service. These values can be used in places of the --url flag:

*Note: Requires access to microphone

speechmatics-flow --auth-token $TOKEN --ssl-mode insecure

Change Assistant (Amelia → Humphrey)

To set the assistant to Humphrey instead of Amelia run this command:

speechmatics-flow --auth-token $TOKEN --ssl-mode insecure --assistant humphrey

Load conversation_config from a config file

Instead of manually setting up conversation parameters, you can load them from a configuration file.

Create a JSON file with the template details, for example "conversation_config.json" and run flow client using the --config-file option

{
  "template_id": "flow-service-assistant-humphrey",
  "template_variables": {
    "persona": "You are an English butler named Humphrey.",
    "style": "Be charming but unpredictable.",
    "context": "You are taking a customer's order at a fast food restaurant."
  }
}
speechmatics-flow --auth-token $TOKEN --ssl-mode insecure --config-file conversation_config.json

Hint: Why limit Humphrey? Try changing the template_variables to see what happens if he’s not a butler but perhaps... a pirate, a celebrity chef, or a royal advisor. We won’t stop you. 🏴‍☠️

Support

If you have any issues with this library or encounter any bugs then please get in touch with us at [email protected].