Skip to content

Commit 60df754

Browse files
authored
Raise ValueError in STT FallbackAdapter when streaming is not supported (#1609)
1 parent 68ac530 commit 60df754

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-agents": patch
3+
---
4+
5+
Raise ValueError in FallbackAdapter when streaming is not supported

livekit-agents/livekit/agents/stt/fallback_adapter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,17 @@ def __init__(
5050
if len(stt) < 1:
5151
raise ValueError("At least one STT instance must be provided.")
5252

53+
non_streaming_stt = [t for t in stt if not t.capabilities.streaming]
54+
if non_streaming_stt:
55+
labels = ", ".join(t.label for t in non_streaming_stt)
56+
raise ValueError(
57+
f"STTs do not support streaming: {labels}. "
58+
"Wrap them with stt.StreamAdapter to enable streaming."
59+
)
60+
5361
super().__init__(
5462
capabilities=STTCapabilities(
55-
streaming=all(t.capabilities.streaming for t in stt),
63+
streaming=True,
5664
interim_results=all(t.capabilities.interim_results for t in stt),
5765
)
5866
)

0 commit comments

Comments
 (0)