livekit-plugins-soniox 1.8.2__tar.gz → 1.8.4__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.
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/PKG-INFO +2 -2
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/stt.py +36 -1
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/version.py +1 -1
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/pyproject.toml +1 -1
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/.gitignore +0 -0
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/README.md +0 -0
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/__init__.py +0 -0
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/log.py +0 -0
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/py.typed +0 -0
- {livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/tts.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: livekit-plugins-soniox
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
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/
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
16
16
|
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
17
17
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
18
|
Requires-Python: >=3.10.0
|
|
19
|
-
Requires-Dist: livekit-agents>=1.8.
|
|
19
|
+
Requires-Dist: livekit-agents>=1.8.4
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
22
22
|
# Soniox plugin for LiveKit Agents
|
|
@@ -298,7 +298,15 @@ class SpeechStream(stt.SpeechStream):
|
|
|
298
298
|
config["translation"] = translation_dict
|
|
299
299
|
# Connect to the Soniox Speech-to-Text API.
|
|
300
300
|
ws = await asyncio.wait_for(
|
|
301
|
-
self._ensure_session().ws_connect(
|
|
301
|
+
self._ensure_session().ws_connect(
|
|
302
|
+
self._stt._base_url,
|
|
303
|
+
# Without a heartbeat a silently dropped socket (half-open TCP, no
|
|
304
|
+
# FIN/RST) is never noticed: `_recv_messages_task` parks on receive
|
|
305
|
+
# forever and the reconnect in `_run` is only ever triggered by that
|
|
306
|
+
# task ending. aiohttp closes the socket itself when a ping goes
|
|
307
|
+
# unanswered, which surfaces as WSMsgType.ERROR in the recv loop.
|
|
308
|
+
heartbeat=30.0,
|
|
309
|
+
),
|
|
302
310
|
timeout=self._conn_options.timeout,
|
|
303
311
|
)
|
|
304
312
|
# Set initial configuration message.
|
|
@@ -392,6 +400,17 @@ class SpeechStream(stt.SpeechStream):
|
|
|
392
400
|
await self._ws.close()
|
|
393
401
|
self._ws = None
|
|
394
402
|
|
|
403
|
+
def _request_reconnect(self, reason: str) -> None:
|
|
404
|
+
"""Ask `_run` to tear down the current socket and open a new one.
|
|
405
|
+
|
|
406
|
+
No-op when there is no socket or a reconnect is already in flight; otherwise the
|
|
407
|
+
`_run` loop would never learn that the connection is gone.
|
|
408
|
+
"""
|
|
409
|
+
if self._ws is None or self._reconnect_event.is_set():
|
|
410
|
+
return
|
|
411
|
+
logger.warning("Soniox STT WebSocket %s; requesting reconnect", reason)
|
|
412
|
+
self._reconnect_event.set()
|
|
413
|
+
|
|
395
414
|
async def _keepalive_task(self) -> None:
|
|
396
415
|
"""Periodically send keepalive messages (while no audio is being sent)
|
|
397
416
|
to maintain the WebSocket connection."""
|
|
@@ -399,6 +418,11 @@ class SpeechStream(stt.SpeechStream):
|
|
|
399
418
|
while self._ws:
|
|
400
419
|
await self._ws.send_str(KEEPALIVE_MESSAGE)
|
|
401
420
|
await asyncio.sleep(5)
|
|
421
|
+
except (aiohttp.ClientError, ConnectionError) as e:
|
|
422
|
+
# When no audio is flowing this write is the only thing touching the socket,
|
|
423
|
+
# so a dropped connection surfaces here first. Swallowing it left the stream
|
|
424
|
+
# parked on a dead socket with nothing ever logged.
|
|
425
|
+
self._request_reconnect(f"keepalive write failed ({e!r})")
|
|
402
426
|
except Exception as e:
|
|
403
427
|
logger.error(f"Error while sending keep alive message: {e}")
|
|
404
428
|
|
|
@@ -430,6 +454,9 @@ class SpeechStream(stt.SpeechStream):
|
|
|
430
454
|
await self._ws.send_str(data)
|
|
431
455
|
except asyncio.CancelledError:
|
|
432
456
|
raise
|
|
457
|
+
except (aiohttp.ClientError, ConnectionError) as e:
|
|
458
|
+
self._request_reconnect(f"audio write failed ({e!r})")
|
|
459
|
+
break
|
|
433
460
|
except Exception as e:
|
|
434
461
|
logger.error(f"Error while sending audio data: {e}")
|
|
435
462
|
break
|
|
@@ -505,6 +532,14 @@ class SpeechStream(stt.SpeechStream):
|
|
|
505
532
|
):
|
|
506
533
|
break
|
|
507
534
|
|
|
535
|
+
if msg.type == aiohttp.WSMsgType.ERROR:
|
|
536
|
+
# The heartbeat closes the socket when a ping goes unanswered, and
|
|
537
|
+
# that arrives here rather than as a close frame. Treating it as an
|
|
538
|
+
# unexpected message type stepped over it and discarded the reason,
|
|
539
|
+
# which only survives on `ws.exception()`.
|
|
540
|
+
logger.warning("Soniox STT WebSocket error frame: %r", self._ws.exception())
|
|
541
|
+
break
|
|
542
|
+
|
|
508
543
|
if msg.type != aiohttp.WSMsgType.TEXT:
|
|
509
544
|
logger.warning(
|
|
510
545
|
f"Unexpected message type from Soniox Speech-to-Text API: {msg.type}"
|
|
@@ -30,7 +30,7 @@ classifiers = [
|
|
|
30
30
|
"Programming Language :: Python :: 3.10",
|
|
31
31
|
"Programming Language :: Python :: 3 :: Only",
|
|
32
32
|
]
|
|
33
|
-
dependencies = ["livekit-agents>=1.8.
|
|
33
|
+
dependencies = ["livekit-agents>=1.8.4"]
|
|
34
34
|
|
|
35
35
|
[project.urls]
|
|
36
36
|
Documentation = "https://docs.livekit.io"
|
|
File without changes
|
|
File without changes
|
{livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{livekit_plugins_soniox-1.8.2 → livekit_plugins_soniox-1.8.4}/livekit/plugins/soniox/py.typed
RENAMED
|
File without changes
|
|
File without changes
|