Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,18 @@ async def _run(self) -> None:
async def keepalive_task(ws: aiohttp.ClientWebSocketResponse) -> None:
try:
while True:
await ws.ping()
await asyncio.sleep(30)
# scribe_v2_realtime model requires a keepalive message instead of a ping
await asyncio.sleep(10)
await ws.send_str(
json.dumps(
{
"message_type": "input_audio_chunk",
"audio_base_64": "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is empty keepalive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any errors after having this, so I think so.

"commit": False,
"sample_rate": self._opts.sample_rate,
}
)
)
except Exception:
return

Expand Down Expand Up @@ -565,10 +575,10 @@ def _process_stream_event(self, data: dict) -> None:
)
self._event_ch.send_nowait(interim_event)

# 11labs sends both when include_timestamps is True
elif (
message_type == "committed_transcript" and not self._opts.include_timestamps
) or message_type == "committed_transcript_with_timestamps":
# 11labs sends both when include_timestamps is True or when the model is scribe_v2_realtime :(
elif (message_type == "committed_transcript" and not self._opts.include_timestamps) or (
message_type == "committed_transcript_with_timestamps" and self._opts.include_timestamps
):
# Final committed transcripts - these are sent to the LLM/TTS layer in LiveKit agents
# and trigger agent responses (unlike partial transcripts which are UI-only)
if text:
Expand Down Expand Up @@ -620,5 +630,10 @@ def _process_stream_event(self, data: dict) -> None:
details_suffix,
)
raise APIConnectionError(f"{message_type}: {error_msg}{details_suffix}")
elif (
message_type == "committed_transcript_with_timestamps"
and not self._opts.include_timestamps
):
pass
else:
logger.warning("ElevenLabs STT unknown message type: %s, data: %s", message_type, data)
Loading