livekit-plugins-speechmatics 1.0.0.dev5__py3-none-any.whl → 1.0.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- livekit/plugins/speechmatics/stt.py +30 -17
- livekit/plugins/speechmatics/utils.py +1 -1
- livekit/plugins/speechmatics/version.py +1 -1
- {livekit_plugins_speechmatics-1.0.0.dev5.dist-info → livekit_plugins_speechmatics-1.0.0rc1.dist-info}/METADATA +2 -2
- livekit_plugins_speechmatics-1.0.0rc1.dist-info/RECORD +10 -0
- livekit_plugins_speechmatics-1.0.0.dev5.dist-info/RECORD +0 -10
- {livekit_plugins_speechmatics-1.0.0.dev5.dist-info → livekit_plugins_speechmatics-1.0.0rc1.dist-info}/WHEEL +0 -0
@@ -30,7 +30,11 @@ from livekit.agents import (
|
|
30
30
|
stt,
|
31
31
|
utils,
|
32
32
|
)
|
33
|
-
from livekit.agents.
|
33
|
+
from livekit.agents.types import (
|
34
|
+
NOT_GIVEN,
|
35
|
+
NotGivenOr,
|
36
|
+
)
|
37
|
+
from livekit.agents.utils import AudioBuffer, is_given
|
34
38
|
|
35
39
|
from .log import logger
|
36
40
|
from .types import (
|
@@ -47,18 +51,11 @@ class STT(stt.STT):
|
|
47
51
|
def __init__(
|
48
52
|
self,
|
49
53
|
*,
|
50
|
-
transcription_config: TranscriptionConfig =
|
51
|
-
|
52
|
-
|
53
|
-
enable_partials=True,
|
54
|
-
max_delay=0.7,
|
55
|
-
),
|
56
|
-
connection_settings: ConnectionSettings = ConnectionSettings(
|
57
|
-
url="wss://eu2.rt.speechmatics.com/v2",
|
58
|
-
),
|
59
|
-
audio_settings: AudioSettings = AudioSettings(),
|
54
|
+
transcription_config: NotGivenOr[TranscriptionConfig] = NOT_GIVEN,
|
55
|
+
connection_settings: NotGivenOr[ConnectionSettings] = NOT_GIVEN,
|
56
|
+
audio_settings: NotGivenOr[AudioSettings] = NOT_GIVEN,
|
60
57
|
http_session: aiohttp.ClientSession | None = None,
|
61
|
-
extra_headers: dict
|
58
|
+
extra_headers: NotGivenOr[dict] = NOT_GIVEN,
|
62
59
|
):
|
63
60
|
super().__init__(
|
64
61
|
capabilities=stt.STTCapabilities(
|
@@ -66,6 +63,20 @@ class STT(stt.STT):
|
|
66
63
|
interim_results=True,
|
67
64
|
),
|
68
65
|
)
|
66
|
+
if not is_given(transcription_config):
|
67
|
+
transcription_config = TranscriptionConfig( # noqa: B008
|
68
|
+
language="en",
|
69
|
+
operating_point="enhanced",
|
70
|
+
enable_partials=True,
|
71
|
+
max_delay=0.7,
|
72
|
+
)
|
73
|
+
if not is_given(connection_settings):
|
74
|
+
connection_settings = ConnectionSettings( # noqa: B008
|
75
|
+
url="wss://eu2.rt.speechmatics.com/v2",
|
76
|
+
)
|
77
|
+
if not is_given(audio_settings):
|
78
|
+
audio_settings = AudioSettings() # noqa: B008
|
79
|
+
|
69
80
|
self._transcription_config = transcription_config
|
70
81
|
self._audio_settings = audio_settings
|
71
82
|
self._connection_settings = connection_settings
|
@@ -83,18 +94,20 @@ class STT(stt.STT):
|
|
83
94
|
self,
|
84
95
|
buffer: AudioBuffer,
|
85
96
|
*,
|
86
|
-
language: str
|
87
|
-
conn_options: APIConnectOptions,
|
97
|
+
language: NotGivenOr[str] = NOT_GIVEN,
|
98
|
+
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
|
88
99
|
) -> stt.SpeechEvent:
|
89
100
|
raise NotImplementedError("Not implemented")
|
90
101
|
|
91
102
|
def stream(
|
92
103
|
self,
|
93
104
|
*,
|
94
|
-
language: str
|
105
|
+
language: NotGivenOr[str] = NOT_GIVEN,
|
95
106
|
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
|
96
107
|
) -> SpeechStream:
|
97
108
|
config = dataclasses.replace(self._audio_settings)
|
109
|
+
if is_given(language):
|
110
|
+
config.language = language
|
98
111
|
stream = SpeechStream(
|
99
112
|
stt=self,
|
100
113
|
transcription_config=self._transcription_config,
|
@@ -118,14 +131,14 @@ class SpeechStream(stt.SpeechStream):
|
|
118
131
|
connection_settings: ConnectionSettings,
|
119
132
|
conn_options: APIConnectOptions,
|
120
133
|
http_session: aiohttp.ClientSession,
|
121
|
-
extra_headers: dict
|
134
|
+
extra_headers: dict,
|
122
135
|
) -> None:
|
123
136
|
super().__init__(stt=stt, conn_options=conn_options, sample_rate=audio_settings.sample_rate)
|
124
137
|
self._transcription_config = transcription_config
|
125
138
|
self._audio_settings = audio_settings
|
126
139
|
self._connection_settings = connection_settings
|
127
140
|
self._session = http_session
|
128
|
-
self._extra_headers = extra_headers
|
141
|
+
self._extra_headers = extra_headers
|
129
142
|
self._speech_duration: float = 0
|
130
143
|
|
131
144
|
self._reconnect_event = asyncio.Event()
|
@@ -18,7 +18,7 @@ async def get_access_token(api_key: str) -> str:
|
|
18
18
|
data = await resp.json()
|
19
19
|
return data["key_value"]
|
20
20
|
except (ValueError, KeyError) as e:
|
21
|
-
raise Exception(f"Failed to parse Speechmatics access token response: {e}")
|
21
|
+
raise Exception(f"Failed to parse Speechmatics access token response: {e}") # noqa: B904
|
22
22
|
else:
|
23
23
|
error_message = await resp.text()
|
24
24
|
raise Exception(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: livekit-plugins-speechmatics
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0rc1
|
4
4
|
Summary: Agent Framework plugin for Speechmatics
|
5
5
|
Project-URL: Documentation, https://docs.livekit.io
|
6
6
|
Project-URL: Website, https://livekit.io/
|
@@ -18,7 +18,7 @@ Classifier: Topic :: Multimedia :: Sound/Audio
|
|
18
18
|
Classifier: Topic :: Multimedia :: Video
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
20
20
|
Requires-Python: >=3.9.0
|
21
|
-
Requires-Dist: livekit-agents>=1.0.0.
|
21
|
+
Requires-Dist: livekit-agents>=1.0.0.rc1
|
22
22
|
Description-Content-Type: text/markdown
|
23
23
|
|
24
24
|
# LiveKit Plugins Speechmatics
|
@@ -0,0 +1,10 @@
|
|
1
|
+
livekit/plugins/speechmatics/__init__.py,sha256=u1BkFot3ggFvlbdohgrWSvPgcfqO79dsRLN6lJsyxnU,919
|
2
|
+
livekit/plugins/speechmatics/log.py,sha256=O1iyAF7cHUu_iMXh6l7KRwwWeDB5QyABI_qzAb0cs04,75
|
3
|
+
livekit/plugins/speechmatics/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
livekit/plugins/speechmatics/stt.py,sha256=a7bYVtH20i2WDbUTp9qRZRqCUrLwW6Yyf1hOAzth7QA,11695
|
5
|
+
livekit/plugins/speechmatics/types.py,sha256=F4Ky9ajT7OztXqspXUCqRX1pwOLMOgWnbdLyJLMi2oQ,4609
|
6
|
+
livekit/plugins/speechmatics/utils.py,sha256=t9ZDg5byXji8GLlpKs2XSNGpmZ5-hm88kmx-UHu2XqU,1825
|
7
|
+
livekit/plugins/speechmatics/version.py,sha256=G8dPSi76U60lNLzCwLQnhZBs52POYYqadur0g9yGdjQ,604
|
8
|
+
livekit_plugins_speechmatics-1.0.0rc1.dist-info/METADATA,sha256=n-lCq7hzVGeWzdVec0LvvuNVG1Yv9u8KTQ0-DgNpilo,1982
|
9
|
+
livekit_plugins_speechmatics-1.0.0rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
livekit_plugins_speechmatics-1.0.0rc1.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
livekit/plugins/speechmatics/__init__.py,sha256=u1BkFot3ggFvlbdohgrWSvPgcfqO79dsRLN6lJsyxnU,919
|
2
|
-
livekit/plugins/speechmatics/log.py,sha256=O1iyAF7cHUu_iMXh6l7KRwwWeDB5QyABI_qzAb0cs04,75
|
3
|
-
livekit/plugins/speechmatics/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
livekit/plugins/speechmatics/stt.py,sha256=e2SS_y8QkTLyxJ1ct05jO5rYzUhDTnLwgCpZumbDOHQ,11131
|
5
|
-
livekit/plugins/speechmatics/types.py,sha256=F4Ky9ajT7OztXqspXUCqRX1pwOLMOgWnbdLyJLMi2oQ,4609
|
6
|
-
livekit/plugins/speechmatics/utils.py,sha256=GGt3Nc3tf38j-xhUCgmbh_mpT4nIB3kcBWsI6pMgA5A,1811
|
7
|
-
livekit/plugins/speechmatics/version.py,sha256=c-54i1xH8x2PJDa4MQknH8Z3398AhQA_tSW6qCqNEn4,605
|
8
|
-
livekit_plugins_speechmatics-1.0.0.dev5.dist-info/METADATA,sha256=eIBCH7c2IuO88bsWuBzjaobrz-pwfUf1zAcNakwyM4k,1985
|
9
|
-
livekit_plugins_speechmatics-1.0.0.dev5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
-
livekit_plugins_speechmatics-1.0.0.dev5.dist-info/RECORD,,
|
File without changes
|