livekit-plugins-soniox 1.2.15__py3-none-any.whl → 1.2.17__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.
Potentially problematic release.
This version of livekit-plugins-soniox might be problematic. Click here for more details.
- livekit/plugins/soniox/__init__.py +9 -2
- livekit/plugins/soniox/stt.py +36 -8
- livekit/plugins/soniox/version.py +1 -1
- {livekit_plugins_soniox-1.2.15.dist-info → livekit_plugins_soniox-1.2.17.dist-info}/METADATA +2 -2
- livekit_plugins_soniox-1.2.17.dist-info/RECORD +8 -0
- livekit_plugins_soniox-1.2.15.dist-info/RECORD +0 -8
- {livekit_plugins_soniox-1.2.15.dist-info → livekit_plugins_soniox-1.2.17.dist-info}/WHEEL +0 -0
|
@@ -17,10 +17,17 @@
|
|
|
17
17
|
See https://docs.livekit.io/agents/integrations/stt/soniox/ for more information.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
from .stt import STT, STTOptions
|
|
20
|
+
from .stt import STT, ContextGeneralItem, ContextObject, ContextTranslationTerm, STTOptions
|
|
21
21
|
from .version import __version__
|
|
22
22
|
|
|
23
|
-
__all__ = [
|
|
23
|
+
__all__ = [
|
|
24
|
+
"STT",
|
|
25
|
+
"STTOptions",
|
|
26
|
+
"ContextObject",
|
|
27
|
+
"ContextGeneralItem",
|
|
28
|
+
"ContextTranslationTerm",
|
|
29
|
+
"__version__",
|
|
30
|
+
]
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
from livekit.agents import Plugin
|
livekit/plugins/soniox/stt.py
CHANGED
|
@@ -18,7 +18,7 @@ import asyncio
|
|
|
18
18
|
import json
|
|
19
19
|
import os
|
|
20
20
|
import time
|
|
21
|
-
from dataclasses import dataclass
|
|
21
|
+
from dataclasses import asdict, dataclass
|
|
22
22
|
|
|
23
23
|
import aiohttp
|
|
24
24
|
|
|
@@ -56,22 +56,47 @@ def is_end_token(token: dict) -> bool:
|
|
|
56
56
|
return token.get("text") in (END_TOKEN, FINALIZED_TOKEN)
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
@dataclass
|
|
60
|
+
class ContextGeneralItem:
|
|
61
|
+
key: str
|
|
62
|
+
value: str
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass
|
|
66
|
+
class ContextTranslationTerm:
|
|
67
|
+
source: str
|
|
68
|
+
target: str
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class ContextObject:
|
|
73
|
+
"""Context object for models with context_version 2, for Soniox stt-rt-v3-preview and higher.
|
|
74
|
+
|
|
75
|
+
Learn more about context in the documentation:
|
|
76
|
+
https://soniox.com/docs/stt/concepts/context
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
general: list[ContextGeneralItem] | None = None
|
|
80
|
+
text: str | None = None
|
|
81
|
+
terms: list[str] | None = None
|
|
82
|
+
translation_terms: list[ContextTranslationTerm] | None = None
|
|
83
|
+
|
|
84
|
+
|
|
59
85
|
@dataclass
|
|
60
86
|
class STTOptions:
|
|
61
87
|
"""Configuration options for Soniox Speech-to-Text service."""
|
|
62
88
|
|
|
63
89
|
model: str | None = "stt-rt-preview"
|
|
90
|
+
|
|
64
91
|
language_hints: list[str] | None = None
|
|
65
|
-
context: str | None = None
|
|
92
|
+
context: ContextObject | str | None = None
|
|
66
93
|
|
|
67
94
|
num_channels: int = 1
|
|
68
95
|
sample_rate: int = 16000
|
|
69
96
|
|
|
97
|
+
enable_speaker_diarization: bool = False
|
|
70
98
|
enable_language_identification: bool = True
|
|
71
99
|
|
|
72
|
-
enable_non_final_tokens: bool = True
|
|
73
|
-
max_non_final_tokens_duration_ms: int | None = None
|
|
74
|
-
|
|
75
100
|
client_reference_id: str | None = None
|
|
76
101
|
|
|
77
102
|
|
|
@@ -176,6 +201,10 @@ class SpeechStream(stt.SpeechStream):
|
|
|
176
201
|
# If VAD was passed, disable endpoint detection, otherwise enable it.
|
|
177
202
|
enable_endpoint_detection = not self._stt._vad_stream
|
|
178
203
|
|
|
204
|
+
context = self._stt._params.context
|
|
205
|
+
if isinstance(context, ContextObject):
|
|
206
|
+
context = asdict(context)
|
|
207
|
+
|
|
179
208
|
# Create initial config object.
|
|
180
209
|
config = {
|
|
181
210
|
"api_key": self._stt._api_key,
|
|
@@ -185,9 +214,8 @@ class SpeechStream(stt.SpeechStream):
|
|
|
185
214
|
"enable_endpoint_detection": enable_endpoint_detection,
|
|
186
215
|
"sample_rate": self._stt._params.sample_rate,
|
|
187
216
|
"language_hints": self._stt._params.language_hints,
|
|
188
|
-
"context":
|
|
189
|
-
"
|
|
190
|
-
"max_non_final_tokens_duration_ms": self._stt._params.max_non_final_tokens_duration_ms,
|
|
217
|
+
"context": context,
|
|
218
|
+
"enable_speaker_diarization": self._stt._params.enable_speaker_diarization,
|
|
191
219
|
"enable_language_identification": self._stt._params.enable_language_identification,
|
|
192
220
|
"client_reference_id": self._stt._params.client_reference_id,
|
|
193
221
|
}
|
{livekit_plugins_soniox-1.2.15.dist-info → livekit_plugins_soniox-1.2.17.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-soniox
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.17
|
|
4
4
|
Summary: Agent Framework plugin for services using Soniox's API.
|
|
5
5
|
Project-URL: Documentation, https://docs.livekit.io
|
|
6
6
|
Project-URL: Website, https://livekit.io/
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
17
|
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
18
18
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
19
|
Requires-Python: >=3.9.0
|
|
20
|
-
Requires-Dist: livekit-agents>=1.2.
|
|
20
|
+
Requires-Dist: livekit-agents>=1.2.17
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
23
|
# Soniox plugin for LiveKit Agents
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
livekit/plugins/soniox/__init__.py,sha256=xCvIeDKtCnq40LelQq4HiB4OG_dpEs_YHsSqFe6qLh0,1361
|
|
2
|
+
livekit/plugins/soniox/log.py,sha256=GNs8rdX3HEj24K-AeVEglYPEXkXTYh0aV_cL0JqVI2c,69
|
|
3
|
+
livekit/plugins/soniox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
livekit/plugins/soniox/stt.py,sha256=Emv5Bvuh9c93fQREaASm_nI5VIJmLirTtZYUdqW24n0,18626
|
|
5
|
+
livekit/plugins/soniox/version.py,sha256=SQ8mRFoSQ7YNG0lOmbx6EypVTyCiYuT7rUNMG_zJJqY,601
|
|
6
|
+
livekit_plugins_soniox-1.2.17.dist-info/METADATA,sha256=5nsDFzInGa1MHA_ZtPdiRDuaObQRISVYjY-xnbqxHhM,2106
|
|
7
|
+
livekit_plugins_soniox-1.2.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
livekit_plugins_soniox-1.2.17.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
livekit/plugins/soniox/__init__.py,sha256=mLCOj2GQSIiKql8Nv_8O1vn1fhoKHXVWH2CZ-4qZivU,1210
|
|
2
|
-
livekit/plugins/soniox/log.py,sha256=GNs8rdX3HEj24K-AeVEglYPEXkXTYh0aV_cL0JqVI2c,69
|
|
3
|
-
livekit/plugins/soniox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
livekit/plugins/soniox/stt.py,sha256=SRfAAN7drYZKRz6HVYin4KTwS78p1eGf8rE4UJhsLtA,18071
|
|
5
|
-
livekit/plugins/soniox/version.py,sha256=PzihL71bIGfvVnuJ06sJkqOP2JIhHRl7e-vbgCcuf_M,601
|
|
6
|
-
livekit_plugins_soniox-1.2.15.dist-info/METADATA,sha256=mqa95UNI4lpZO05EKeegwPWv5_5Ar0sAzYNEoiRCpT4,2106
|
|
7
|
-
livekit_plugins_soniox-1.2.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
livekit_plugins_soniox-1.2.15.dist-info/RECORD,,
|
|
File without changes
|