Agent Framework plugin for Speechmatics
Project description
Speechmatics STT plugin for LiveKit Agents
Support for Speechmatics STT.
See https://docs.livekit.io/agents/integrations/stt/speechmatics/ for more information.
Installation
pip install livekit-plugins-speechmatics
Diarization
Speechmatics STT engine can be configured to emit information about individual speakers in a conversation. This needs to be enabled using enable_diarization=True. The text output of the transcription can be configured to include this information using the macros speaker_id and text, as shown in the examples below.
<{speaker_id}>{text}</{speaker_id}>-><S1>Hello</S1>[Speaker {speaker_id}] {text}->[Speaker S1] Hello
You should adjust your system instructions to inform the LLM of this format for speaker identification.
Turn detection modes
The turn_detection_mode parameter controls how end-of-turn is detected:
EXTERNAL(default) — Speechmatics does not endpoint on its own; turn boundaries are driven by an external VAD or by callingfinalize(). If novadis passed, Silero is auto-loaded (requireslivekit-plugins-silero). Passvad=Noneto opt out and drivefinalize()yourself.ADAPTIVE— Speechmatics controls end of turn using its own VAD and the pace of speech.SMART_TURN— Speechmatics ML-based endpointing.FIXED— Endpoints after a fixed silence duration set byend_of_utterance_silence_trigger.
Usage (LiveKit Turn Detection)
The default EXTERNAL mode pairs naturally with LiveKit's turn detector. The format for the output text needs to be adjusted to not include any extra content at the end of the utterance. Using [Speaker S1] ... as the speaker_active_format should work well. You may need to adjust your system instructions to inform the LLM of this format for speaker identification. You must also include the listener for when the VAD has detected the end of speech.
The end_of_utterance_silence_trigger parameter controls the amount of silence before the end of turn detection is triggered. The default is 0.5 seconds.
Usage:
from livekit.agents import AgentSession, inference
from livekit.agents.inference import AudioTurnDetector
from livekit.plugins import speechmatics
agent = AgentSession(
stt=speechmatics.STT(
end_of_utterance_silence_trigger=0.2,
speaker_active_format="[Speaker {speaker_id}] {text}",
speaker_passive_format="[Speaker {speaker_id} *PASSIVE*] {text}",
),
vad=inference.VAD(),
turn_detection=AudioTurnDetector(),
min_endpointing_delay=0.3,
max_endpointing_delay=5.0,
...
)
Usage (Speechmatics end of utterance detection and speaker ID)
To delegate end-of-turn detection to Speechmatics, set turn_detection_mode=TurnDetectionMode.ADAPTIVE (or SMART_TURN / FIXED) and pair it with turn_detection="stt" on the AgentSession.
from livekit.agents import AgentSession
from livekit.plugins import speechmatics
agent = AgentSession(
stt=speechmatics.STT(
turn_detection_mode=speechmatics.TurnDetectionMode.ADAPTIVE,
speaker_active_format="[Speaker {speaker_id}] {text}",
speaker_passive_format="[Speaker {speaker_id} *PASSIVE*] {text}",
additional_vocab=[
speechmatics.AdditionalVocabEntry(
content="LiveKit",
sounds_like=["live kit"],
),
],
),
turn_detection="stt",
...
)
Pre-requisites
You'll need to specify a Speechmatics API Key. It can be set as environment variable SPEECHMATICS_API_KEY or .env.local file.
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_speechmatics-1.6.0rc1.tar.gz.
File metadata
- Download URL: livekit_plugins_speechmatics-1.6.0rc1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fb54e9a780672c6110ccc997a4cef88f53e163ac3215e6f3fb3ad97c78091b0
|
|
| MD5 |
f3ff4ccdc87efe886c2cd4255212b6d1
|
|
| BLAKE2b-256 |
a5bfe184a0f2944bf6f821165ffdb4d20dd30dd1a4004f459aeb73f6a1ec939d
|
Provenance
The following attestation bundles were made for livekit_plugins_speechmatics-1.6.0rc1.tar.gz:
Publisher:
publish.yml on livekit/agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
livekit_plugins_speechmatics-1.6.0rc1.tar.gz -
Subject digest:
1fb54e9a780672c6110ccc997a4cef88f53e163ac3215e6f3fb3ad97c78091b0 - Sigstore transparency entry: 1646736849
- Sigstore integration time:
-
Permalink:
livekit/agents@6c713de3e19f6081c0857fcebe5ee4c51566e9ce -
Branch / Tag:
refs/heads/feat/AGT-2520-multimodal-EOU - Owner: https://github.com/livekit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c713de3e19f6081c0857fcebe5ee4c51566e9ce -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file livekit_plugins_speechmatics-1.6.0rc1-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_speechmatics-1.6.0rc1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
766f42fe8c18e7b73174740926a7a0d68d02c005c4aaae3899ad20ec3bc42b58
|
|
| MD5 |
c796d68f3891b0d01b3bc72adb8e16af
|
|
| BLAKE2b-256 |
4ce82356a4aa628e038b65dcc5744b3e8fea15a31127508e0c86d5fe32969882
|
Provenance
The following attestation bundles were made for livekit_plugins_speechmatics-1.6.0rc1-py3-none-any.whl:
Publisher:
publish.yml on livekit/agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
livekit_plugins_speechmatics-1.6.0rc1-py3-none-any.whl -
Subject digest:
766f42fe8c18e7b73174740926a7a0d68d02c005c4aaae3899ad20ec3bc42b58 - Sigstore transparency entry: 1646736962
- Sigstore integration time:
-
Permalink:
livekit/agents@6c713de3e19f6081c0857fcebe5ee4c51566e9ce -
Branch / Tag:
refs/heads/feat/AGT-2520-multimodal-EOU - Owner: https://github.com/livekit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6c713de3e19f6081c0857fcebe5ee4c51566e9ce -
Trigger Event:
pull_request
-
Statement type: