livekit-plugins-clova 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.
Potentially problematic release.
This version of livekit-plugins-clova might be problematic. Click here for more details.
- livekit/plugins/clova/stt.py +28 -12
- livekit/plugins/clova/version.py +1 -1
- {livekit_plugins_clova-1.0.0.dev5.dist-info → livekit_plugins_clova-1.0.0rc1.dist-info}/METADATA +2 -2
- livekit_plugins_clova-1.0.0rc1.dist-info/RECORD +10 -0
- livekit_plugins_clova-1.0.0.dev5.dist-info/RECORD +0 -10
- {livekit_plugins_clova-1.0.0.dev5.dist-info → livekit_plugins_clova-1.0.0rc1.dist-info}/WHEEL +0 -0
livekit/plugins/clova/stt.py
CHANGED
|
@@ -23,9 +23,20 @@ import wave
|
|
|
23
23
|
|
|
24
24
|
import aiohttp
|
|
25
25
|
|
|
26
|
-
from livekit.agents import
|
|
26
|
+
from livekit.agents import (
|
|
27
|
+
APIConnectOptions,
|
|
28
|
+
APIStatusError,
|
|
29
|
+
APITimeoutError,
|
|
30
|
+
stt,
|
|
31
|
+
utils,
|
|
32
|
+
)
|
|
27
33
|
from livekit.agents.stt import SpeechEventType, STTCapabilities
|
|
28
|
-
from livekit.agents.
|
|
34
|
+
from livekit.agents.types import (
|
|
35
|
+
DEFAULT_API_CONNECT_OPTIONS,
|
|
36
|
+
NOT_GIVEN,
|
|
37
|
+
NotGivenOr,
|
|
38
|
+
)
|
|
39
|
+
from livekit.agents.utils import AudioBuffer, is_given, merge_frames
|
|
29
40
|
from livekit.plugins.clova.constants import CLOVA_INPUT_SAMPLE_RATE
|
|
30
41
|
|
|
31
42
|
from .common import resample_audio
|
|
@@ -37,9 +48,9 @@ class STT(stt.STT):
|
|
|
37
48
|
def __init__(
|
|
38
49
|
self,
|
|
39
50
|
*,
|
|
40
|
-
language: ClovaSttLanguages = "en-US",
|
|
41
|
-
secret: str
|
|
42
|
-
invoke_url: str
|
|
51
|
+
language: ClovaSttLanguages | str = "en-US",
|
|
52
|
+
secret: NotGivenOr[str] = NOT_GIVEN,
|
|
53
|
+
invoke_url: NotGivenOr[str] = NOT_GIVEN,
|
|
43
54
|
http_session: aiohttp.ClientSession | None = None,
|
|
44
55
|
threshold: float = 0.5,
|
|
45
56
|
):
|
|
@@ -51,8 +62,10 @@ class STT(stt.STT):
|
|
|
51
62
|
"""
|
|
52
63
|
|
|
53
64
|
super().__init__(capabilities=STTCapabilities(streaming=False, interim_results=True))
|
|
54
|
-
self._secret = secret
|
|
55
|
-
self._invoke_url =
|
|
65
|
+
self._secret = secret if is_given(secret) else os.environ.get("CLOVA_STT_SECRET_KEY")
|
|
66
|
+
self._invoke_url = (
|
|
67
|
+
invoke_url if is_given(invoke_url) else os.environ.get("CLOVA_STT_INVOKE_URL")
|
|
68
|
+
)
|
|
56
69
|
self._language = clova_languages_mapping.get(language, language)
|
|
57
70
|
self._session = http_session
|
|
58
71
|
if self._secret is None:
|
|
@@ -61,8 +74,9 @@ class STT(stt.STT):
|
|
|
61
74
|
)
|
|
62
75
|
self.threshold = threshold
|
|
63
76
|
|
|
64
|
-
def update_options(self, *, language: str
|
|
65
|
-
|
|
77
|
+
def update_options(self, *, language: NotGivenOr[str] = NOT_GIVEN) -> None:
|
|
78
|
+
if is_given(language):
|
|
79
|
+
self._language = clova_languages_mapping.get(language, language)
|
|
66
80
|
|
|
67
81
|
def _ensure_session(self) -> aiohttp.ClientSession:
|
|
68
82
|
if not self._session:
|
|
@@ -76,11 +90,13 @@ class STT(stt.STT):
|
|
|
76
90
|
self,
|
|
77
91
|
buffer: AudioBuffer,
|
|
78
92
|
*,
|
|
79
|
-
language: ClovaSttLanguages | str
|
|
80
|
-
conn_options: APIConnectOptions,
|
|
93
|
+
language: NotGivenOr[ClovaSttLanguages | str] = NOT_GIVEN,
|
|
94
|
+
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
|
|
81
95
|
) -> stt.SpeechEvent:
|
|
82
96
|
try:
|
|
83
97
|
url = self.url_builder()
|
|
98
|
+
if is_given(language):
|
|
99
|
+
self._language = clova_languages_mapping.get(language, language)
|
|
84
100
|
payload = json.dumps({"language": self._language, "completion": "sync"})
|
|
85
101
|
|
|
86
102
|
buffer = merge_frames(buffer)
|
|
@@ -136,8 +152,8 @@ class STT(stt.STT):
|
|
|
136
152
|
|
|
137
153
|
def _transcription_to_speech_event(
|
|
138
154
|
self,
|
|
155
|
+
text: str,
|
|
139
156
|
event_type: SpeechEventType = stt.SpeechEventType.INTERIM_TRANSCRIPT,
|
|
140
|
-
text: str | None = None,
|
|
141
157
|
) -> stt.SpeechEvent:
|
|
142
158
|
return stt.SpeechEvent(
|
|
143
159
|
type=event_type,
|
livekit/plugins/clova/version.py
CHANGED
{livekit_plugins_clova-1.0.0.dev5.dist-info → livekit_plugins_clova-1.0.0rc1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-clova
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0rc1
|
|
4
4
|
Summary: LiveKit Agents Plugin for LINE Clova STT
|
|
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
|
Requires-Dist: pydub~=0.25.1
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
livekit/plugins/clova/__init__.py,sha256=WelhQwAYhVLN1OYJjlXDe1k1rSj6lJQLIYSgdiA4Xp4,508
|
|
2
|
+
livekit/plugins/clova/common.py,sha256=67vNmTLX7le5nTpM4N8MFNmQuIYCXy7NKf9-OkP1JmI,359
|
|
3
|
+
livekit/plugins/clova/constants.py,sha256=b6X_va-KsJWDsDdjo-nka7yae_9fVmTnTb_sQm8gQao,66
|
|
4
|
+
livekit/plugins/clova/log.py,sha256=odnkyQ2umM1S3wZiHAaOrUowHZl-de1y57MXL9CD1uI,68
|
|
5
|
+
livekit/plugins/clova/models.py,sha256=R71m_BcWxmdqSPIrfc49a0yuJMlcrzT8HuQZTWmCpQk,378
|
|
6
|
+
livekit/plugins/clova/stt.py,sha256=cWU9t507GB6v1X1iYOO3kxtzvPM-A5YZQdRFtFRH5kI,5991
|
|
7
|
+
livekit/plugins/clova/version.py,sha256=pF0lh6G9GYL7Mj7EnfhjFifzlzdWx6u3RvB0Itch4UE,604
|
|
8
|
+
livekit_plugins_clova-1.0.0rc1.dist-info/METADATA,sha256=XZTdPyx2GY_X3JEQa1GmspDZszZ7MHAcleOF8oXx7zw,1394
|
|
9
|
+
livekit_plugins_clova-1.0.0rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
livekit_plugins_clova-1.0.0rc1.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
livekit/plugins/clova/__init__.py,sha256=WelhQwAYhVLN1OYJjlXDe1k1rSj6lJQLIYSgdiA4Xp4,508
|
|
2
|
-
livekit/plugins/clova/common.py,sha256=67vNmTLX7le5nTpM4N8MFNmQuIYCXy7NKf9-OkP1JmI,359
|
|
3
|
-
livekit/plugins/clova/constants.py,sha256=b6X_va-KsJWDsDdjo-nka7yae_9fVmTnTb_sQm8gQao,66
|
|
4
|
-
livekit/plugins/clova/log.py,sha256=odnkyQ2umM1S3wZiHAaOrUowHZl-de1y57MXL9CD1uI,68
|
|
5
|
-
livekit/plugins/clova/models.py,sha256=R71m_BcWxmdqSPIrfc49a0yuJMlcrzT8HuQZTWmCpQk,378
|
|
6
|
-
livekit/plugins/clova/stt.py,sha256=YCAgfCBEhITVMy-hki3QMbjcvkHNmauxMecQU6X9PNk,5581
|
|
7
|
-
livekit/plugins/clova/version.py,sha256=pXgCpV03nQI-5Kk-74NFyAdw1htj2cx6unwQHipEcfE,605
|
|
8
|
-
livekit_plugins_clova-1.0.0.dev5.dist-info/METADATA,sha256=NPTEOyBtoxu1_rqe5WlvOGPwBPRIiJ-Qn118P-fYtbg,1397
|
|
9
|
-
livekit_plugins_clova-1.0.0.dev5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
-
livekit_plugins_clova-1.0.0.dev5.dist-info/RECORD,,
|
{livekit_plugins_clova-1.0.0.dev5.dist-info → livekit_plugins_clova-1.0.0rc1.dist-info}/WHEEL
RENAMED
|
File without changes
|