Skip to content

Commit

Permalink
Add Speechmatics STT plugin (livekit#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumitrugutu authored Mar 3, 2025
1 parent 4a8b2ff commit 60d0b1d
Show file tree
Hide file tree
Showing 17 changed files with 690 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ jobs:
-p livekit.plugins.playai \
-p livekit.plugins.assemblyai \
-p livekit.plugins.rime \
-p livekit.plugins.aws
-p livekit.plugins.aws \
-p livekit.plugins.speechmatics
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
PLAYHT_USER_ID: ${{ secrets.PLAYHT_USER_ID }}
RIME_API_KEY: ${{ secrets.RIME_API_KEY }}
SPEECHMATICS_API_KEY: ${{ secrets.SPEECHMATICS_API_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: google.json
PYTEST_ADDOPTS: "--color=yes"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
3 changes: 2 additions & 1 deletion livekit-plugins/install_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ pip install \
"${SCRIPT_DIR}/livekit-plugins-silero" \
"${SCRIPT_DIR}/livekit-plugins-turn-detector" \
"${SCRIPT_DIR}/livekit-plugins-rime" \
"${SCRIPT_DIR}/livekit-plugins-aws"
"${SCRIPT_DIR}/livekit-plugins-aws" \
"${SCRIPT_DIR}/livekit-plugins-speechmatics"
1 change: 1 addition & 0 deletions livekit-plugins/install_plugins_editable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ pip install -e ./livekit-plugins-rime --config-settings editable_mode=strict
pip install -e ./livekit-plugins-llama-index --config-settings editable_mode=strict
pip install -e ./livekit-plugins-turn-detector --config-settings editable_mode=strict
pip install -e ./livekit-plugins-silero --config-settings editable_mode=strict
pip install -e ./livekit-plugins-speechmatics --config-settings editable_mode=strict
pip install -e ./livekit-plugins-browser --config-settings editable_mode=strict

7 changes: 7 additions & 0 deletions livekit-plugins/livekit-plugins-speechmatics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# livekit-plugins-speechmatics

## 0.0.1

### Minor changes

- Add speechmatics plugin [#1510](https://github.com/livekit/agents/pull/1510) ([@dumitrugutu](https://github.com/dumitrugutu))
33 changes: 33 additions & 0 deletions livekit-plugins/livekit-plugins-speechmatics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# LiveKit Plugins Speechmatics

Agent Framework plugin for Speechmatics.

## Installation

```bash
pip install livekit-plugins-speechmatics
```

Usage:

```python
agent = VoicePipelineAgent(
stt=speechmatics.STT(),
turn_detector=turn_detector.EOUModel(),
min_endpointing_delay=0.5,
max_endpointing_delay=5.0,
...
)
```

Note: The plugin was built with
LiveKit's [end-of-turn detection feature](https://github.com/livekit/agents#in-house-phrase-endpointing-model) in mind,
and it doesn't implement phrase endpointing. `AddTranscript` and `AddPartialTranscript` events are emitted as soon
as they’re received from the Speechmatics STT engine. For the best user experience,
we recommend running the agent with end-of-turn detection enabled (
see [example](https://github.com/livekit-examples/voice-pipeline-agent-python/blob/main/agent.py)).

## 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .log import logger
from .stt import STT, SpeechStream
from .version import __version__

__all__ = [
"STT",
"SpeechStream",
"logger",
"__version__",
]

from livekit.agents import Plugin


class SpeechmaticsPlugin(Plugin):
def __init__(self):
super().__init__(__name__, __version__, __package__)


Plugin.register_plugin(SpeechmaticsPlugin())
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import logging

logger = logging.getLogger("livekit.plugins.speechmatics")
Empty file.
Loading

0 comments on commit 60d0b1d

Please sign in to comment.