Skip to content

Commit 60d0b1d

Browse files
authored
Add Speechmatics STT plugin (#1510)
1 parent 4a8b2ff commit 60d0b1d

File tree

17 files changed

+690
-2
lines changed

17 files changed

+690
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ jobs:
8383
-p livekit.plugins.playai \
8484
-p livekit.plugins.assemblyai \
8585
-p livekit.plugins.rime \
86-
-p livekit.plugins.aws
86+
-p livekit.plugins.aws \
87+
-p livekit.plugins.speechmatics

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ jobs:
113113
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
114114
PLAYHT_USER_ID: ${{ secrets.PLAYHT_USER_ID }}
115115
RIME_API_KEY: ${{ secrets.RIME_API_KEY }}
116+
SPEECHMATICS_API_KEY: ${{ secrets.SPEECHMATICS_API_KEY }}
116117
GOOGLE_APPLICATION_CREDENTIALS: google.json
117118
PYTEST_ADDOPTS: "--color=yes"
118119
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

livekit-plugins/install_local.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ pip install \
2121
"${SCRIPT_DIR}/livekit-plugins-silero" \
2222
"${SCRIPT_DIR}/livekit-plugins-turn-detector" \
2323
"${SCRIPT_DIR}/livekit-plugins-rime" \
24-
"${SCRIPT_DIR}/livekit-plugins-aws"
24+
"${SCRIPT_DIR}/livekit-plugins-aws" \
25+
"${SCRIPT_DIR}/livekit-plugins-speechmatics"

livekit-plugins/install_plugins_editable.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ pip install -e ./livekit-plugins-rime --config-settings editable_mode=strict
2222
pip install -e ./livekit-plugins-llama-index --config-settings editable_mode=strict
2323
pip install -e ./livekit-plugins-turn-detector --config-settings editable_mode=strict
2424
pip install -e ./livekit-plugins-silero --config-settings editable_mode=strict
25+
pip install -e ./livekit-plugins-speechmatics --config-settings editable_mode=strict
2526
pip install -e ./livekit-plugins-browser --config-settings editable_mode=strict
2627

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# livekit-plugins-speechmatics
2+
3+
## 0.0.1
4+
5+
### Minor changes
6+
7+
- Add speechmatics plugin [#1510](https://github.com/livekit/agents/pull/1510) ([@dumitrugutu](https://github.com/dumitrugutu))
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# LiveKit Plugins Speechmatics
2+
3+
Agent Framework plugin for Speechmatics.
4+
5+
## Installation
6+
7+
```bash
8+
pip install livekit-plugins-speechmatics
9+
```
10+
11+
Usage:
12+
13+
```python
14+
agent = VoicePipelineAgent(
15+
stt=speechmatics.STT(),
16+
turn_detector=turn_detector.EOUModel(),
17+
min_endpointing_delay=0.5,
18+
max_endpointing_delay=5.0,
19+
...
20+
)
21+
```
22+
23+
Note: The plugin was built with
24+
LiveKit's [end-of-turn detection feature](https://github.com/livekit/agents#in-house-phrase-endpointing-model) in mind,
25+
and it doesn't implement phrase endpointing. `AddTranscript` and `AddPartialTranscript` events are emitted as soon
26+
as they’re received from the Speechmatics STT engine. For the best user experience,
27+
we recommend running the agent with end-of-turn detection enabled (
28+
see [example](https://github.com/livekit-examples/voice-pipeline-agent-python/blob/main/agent.py)).
29+
30+
## Pre-requisites
31+
32+
You'll need to specify a Speechmatics API Key. It can be set as environment variable `SPEECHMATICS_API_KEY` or
33+
`.env.local` file.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
from .log import logger
14+
from .stt import STT, SpeechStream
15+
from .version import __version__
16+
17+
__all__ = [
18+
"STT",
19+
"SpeechStream",
20+
"logger",
21+
"__version__",
22+
]
23+
24+
from livekit.agents import Plugin
25+
26+
27+
class SpeechmaticsPlugin(Plugin):
28+
def __init__(self):
29+
super().__init__(__name__, __version__, __package__)
30+
31+
32+
Plugin.register_plugin(SpeechmaticsPlugin())
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import logging
2+
3+
logger = logging.getLogger("livekit.plugins.speechmatics")

livekit-plugins/livekit-plugins-speechmatics/livekit/plugins/speechmatics/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)