livekit-plugins-azure 1.0.0rc5__py3-none-any.whl → 1.0.0rc6__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.
@@ -42,7 +42,7 @@ class STTOptions:
42
42
  segmentation_silence_timeout_ms: NotGivenOr[int]
43
43
  segmentation_max_time_ms: NotGivenOr[int]
44
44
  segmentation_strategy: NotGivenOr[str]
45
- languages: list[
45
+ language: list[
46
46
  str
47
47
  ] # see https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt
48
48
  speech_endpoint: NotGivenOr[str] = NOT_GIVEN
@@ -63,9 +63,7 @@ class STT(stt.STT):
63
63
  segmentation_max_time_ms: NotGivenOr[int] = NOT_GIVEN,
64
64
  segmentation_strategy: NotGivenOr[str] = NOT_GIVEN,
65
65
  # Azure handles multiple languages and can auto-detect the language used. It requires the candidate set to be set. # noqa: E501
66
- languages: NotGivenOr[list[str]] = NOT_GIVEN,
67
- # for compatibility with other STT plugins
68
- language: NotGivenOr[str] = NOT_GIVEN,
66
+ language: NotGivenOr[str | list[str] | None] = NOT_GIVEN,
69
67
  profanity: NotGivenOr[speechsdk.enums.ProfanityOption] = NOT_GIVEN,
70
68
  ):
71
69
  """
@@ -79,12 +77,11 @@ class STT(stt.STT):
79
77
  """
80
78
 
81
79
  super().__init__(capabilities=stt.STTCapabilities(streaming=True, interim_results=True))
80
+ if not language or not is_given(language):
81
+ language = ["en-US"]
82
82
 
83
- if not is_given(languages):
84
- languages = ["en-US"]
85
-
86
- if is_given(language) and not is_given(languages):
87
- languages = [language]
83
+ if isinstance(language, str):
84
+ language = [language]
88
85
 
89
86
  if not is_given(speech_host):
90
87
  speech_host = os.environ.get("AZURE_SPEECH_HOST")
@@ -109,7 +106,7 @@ class STT(stt.STT):
109
106
  speech_region=speech_region,
110
107
  speech_host=speech_host,
111
108
  speech_auth_token=speech_auth_token,
112
- languages=languages,
109
+ language=language,
113
110
  sample_rate=sample_rate,
114
111
  num_channels=num_channels,
115
112
  segmentation_silence_timeout_ms=segmentation_silence_timeout_ms,
@@ -131,28 +128,23 @@ class STT(stt.STT):
131
128
  def stream(
132
129
  self,
133
130
  *,
134
- languages: NotGivenOr[list[str]] = NOT_GIVEN,
135
131
  language: NotGivenOr[str] = NOT_GIVEN,
136
132
  conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
137
133
  ) -> SpeechStream:
138
134
  config = deepcopy(self._config)
139
- if is_given(language) and not is_given(languages):
140
- languages = [language]
141
- if is_given(languages):
142
- config.languages = languages
135
+ if is_given(language):
136
+ config.language = [language]
143
137
  stream = SpeechStream(stt=self, opts=config, conn_options=conn_options)
144
138
  self._streams.add(stream)
145
139
  return stream
146
140
 
147
- def update_options(
148
- self, *, language: NotGivenOr[str] = NOT_GIVEN, languages: NotGivenOr[list[str]] = NOT_GIVEN
149
- ):
150
- if is_given(language) and not is_given(languages):
151
- languages = [language]
152
- if is_given(languages):
153
- self._config.languages = languages
141
+ def update_options(self, *, language: NotGivenOr[list[str] | str] = NOT_GIVEN):
142
+ if is_given(language):
143
+ if isinstance(language, str):
144
+ language = [language]
145
+ self._config.language = language
154
146
  for stream in self._streams:
155
- stream.update_options(languages=languages)
147
+ stream.update_options(language=language)
156
148
 
157
149
 
158
150
  class SpeechStream(stt.SpeechStream):
@@ -167,8 +159,8 @@ class SpeechStream(stt.SpeechStream):
167
159
  self._loop = asyncio.get_running_loop()
168
160
  self._reconnect_event = asyncio.Event()
169
161
 
170
- def update_options(self, *, languages: list[str]):
171
- self._opts.languages = languages
162
+ def update_options(self, *, language: list[str]):
163
+ self._opts.language = language
172
164
  self._reconnect_event.set()
173
165
 
174
166
  async def _run(self) -> None:
@@ -232,8 +224,8 @@ class SpeechStream(stt.SpeechStream):
232
224
  if not text:
233
225
  return
234
226
 
235
- if not detected_lg and self._opts.languages:
236
- detected_lg = self._opts.languages[0]
227
+ if not detected_lg and self._opts.language:
228
+ detected_lg = self._opts.language[0]
237
229
 
238
230
  final_data = stt.SpeechData(language=detected_lg, confidence=1.0, text=evt.result.text)
239
231
 
@@ -251,8 +243,8 @@ class SpeechStream(stt.SpeechStream):
251
243
  if not text:
252
244
  return
253
245
 
254
- if not detected_lg and self._opts.languages:
255
- detected_lg = self._opts.languages[0]
246
+ if not detected_lg and self._opts.language:
247
+ detected_lg = self._opts.language[0]
256
248
 
257
249
  interim_data = stt.SpeechData(language=detected_lg, confidence=0.0, text=evt.result.text)
258
250
 
@@ -331,9 +323,9 @@ def _create_speech_recognizer(
331
323
  speech_config.set_profanity(config.profanity)
332
324
 
333
325
  auto_detect_source_language_config = None
334
- if config.languages and len(config.languages) >= 1:
326
+ if config.language and len(config.language) >= 1:
335
327
  auto_detect_source_language_config = (
336
- speechsdk.languageconfig.AutoDetectSourceLanguageConfig(languages=config.languages)
328
+ speechsdk.languageconfig.AutoDetectSourceLanguageConfig(languages=config.language)
337
329
  )
338
330
 
339
331
  audio_config = speechsdk.audio.AudioConfig(stream=stream)
@@ -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.rc5'
15
+ __version__ = '1.0.0.rc6'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-azure
3
- Version: 1.0.0rc5
3
+ Version: 1.0.0rc6
4
4
  Summary: Agent Framework plugin for services from Azure
5
5
  Project-URL: Documentation, https://docs.livekit.io
6
6
  Project-URL: Website, https://livekit.io/
@@ -19,7 +19,7 @@ Classifier: Topic :: Multimedia :: Video
19
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Requires-Python: >=3.9.0
21
21
  Requires-Dist: azure-cognitiveservices-speech>=1.41.0
22
- Requires-Dist: livekit-agents>=1.0.0.rc5
22
+ Requires-Dist: livekit-agents>=1.0.0.rc6
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # LiveKit Plugins Azure
@@ -0,0 +1,9 @@
1
+ livekit/plugins/azure/__init__.py,sha256=8YPW1EAltd4oip3WItsMy17EMekroUzTPLFRIwLP2Wc,1082
2
+ livekit/plugins/azure/log.py,sha256=MeD0unQJ72aDc9K8zUi9LgUBls6h2WUALryOjAumrKs,68
3
+ livekit/plugins/azure/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ livekit/plugins/azure/stt.py,sha256=TdjTMwSNlVBnrY6IB8ndS7OLuVOJtV1o3O7O4Vlnmsw,13566
5
+ livekit/plugins/azure/tts.py,sha256=A2x7f1iS7dTZij1K7FoVILynfU1YGQiwG5venknrfXo,19073
6
+ livekit/plugins/azure/version.py,sha256=qZh2FFomSNmhmQja3MpLQ_YaT2dWbZTKV3roNzTxx2I,604
7
+ livekit_plugins_azure-1.0.0rc6.dist-info/METADATA,sha256=SS8LyZ-6MmR6dtOFBeT-X7xii5VJYPXpXMC4BL7Xt54,1401
8
+ livekit_plugins_azure-1.0.0rc6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ livekit_plugins_azure-1.0.0rc6.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- livekit/plugins/azure/__init__.py,sha256=8YPW1EAltd4oip3WItsMy17EMekroUzTPLFRIwLP2Wc,1082
2
- livekit/plugins/azure/log.py,sha256=MeD0unQJ72aDc9K8zUi9LgUBls6h2WUALryOjAumrKs,68
3
- livekit/plugins/azure/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- livekit/plugins/azure/stt.py,sha256=wyogn3xBu4priWWJGQmueRHlnbcsexKh0GgEy6FoUoM,13890
5
- livekit/plugins/azure/tts.py,sha256=A2x7f1iS7dTZij1K7FoVILynfU1YGQiwG5venknrfXo,19073
6
- livekit/plugins/azure/version.py,sha256=JEZkv533Wuw_WOd9Rdf4Nedr_tL3V7ocBZ5Z16YZoHI,604
7
- livekit_plugins_azure-1.0.0rc5.dist-info/METADATA,sha256=0xcIp9h6Ep_0hgiztksTx8P0EXsY7Um15Y-dp8lx2iA,1401
8
- livekit_plugins_azure-1.0.0rc5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- livekit_plugins_azure-1.0.0rc5.dist-info/RECORD,,