livekit-plugins-clova 1.0.0.dev4__tar.gz → 1.0.0rc1__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-clova
3
- Version: 1.0.0.dev4
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,8 @@ 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.dev4
21
+ Requires-Dist: livekit-agents>=1.0.0.rc1
22
+ Requires-Dist: pydub~=0.25.1
22
23
  Description-Content-Type: text/markdown
23
24
 
24
25
  # LiveKit Plugins Clova
@@ -23,9 +23,20 @@ import wave
23
23
 
24
24
  import aiohttp
25
25
 
26
- from livekit.agents import APIConnectOptions, APIStatusError, APITimeoutError, stt, utils
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.utils import AudioBuffer, merge_frames
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 | None = None,
42
- invoke_url: str | None = None,
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 or os.environ.get("CLOVA_STT_SECRET_KEY")
55
- self._invoke_url = invoke_url or os.environ.get("CLOVA_STT_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 | None = None) -> None:
65
- self._language = clova_languages_mapping.get(language, language) or self._language
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 | None,
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,
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "1.0.0.dev4"
15
+ __version__ = '1.0.0.rc1'
@@ -22,7 +22,7 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.10",
23
23
  "Programming Language :: Python :: 3 :: Only",
24
24
  ]
25
- dependencies = ["livekit-agents>=1.0.0.dev4"]
25
+ dependencies = ["livekit-agents>=1.0.0.rc1", "pydub~=0.25.1"]
26
26
 
27
27
  [project.urls]
28
28
  Documentation = "https://docs.livekit.io"