TranscriptionStreamReceiver class
Converts LiveKit transcription text streams into ReceivedMessages.
This receiver is intended for agent-powered transcription streams produced by
the LiveKit Agents framework (text streams require livekit-agents >= 1.0.0).
The receiver listens on a text stream topic (default: 'lk.transcription')
and aggregates chunked updates into a single ReceivedMessage per transcript
segment.
Text stream semantics
- Agent transcripts: the agent emits a new text stream for each message. The stream yields chunks that should be appended until the transcript is finalized.
- User transcripts: the agent may resend the full transcription text for a segment on each update (until finalized).
Message identity / diffing
The segment id (lk.segment_id) is stable across the lifetime of a transcript
segment. This receiver uses it as ReceivedMessage.id, which makes it safe
to use for UI diffing (e.g. ListView keys). If lk.segment_id is missing,
the text stream id is used as a fallback.
When a new segment for the same participant arrives, older partial segments are removed to keep memory usage bounded.
Example (agent transcript chunks)
Incoming chunks (same segment id):
{ segment_id: "1", content: "Hello" }
{ segment_id: "1", content: " world" }
{ segment_id: "1", content: "!" }
Output messages:
ReceivedMessage(id: "1", content: AgentTranscript("Hello"))
ReceivedMessage(id: "1", content: AgentTranscript("Hello world"))
ReceivedMessage(id: "1", content: AgentTranscript("Hello world!"))
- SeeAlso: https://docs.livekit.io/agents/
- Implemented types
Constructors
- TranscriptionStreamReceiver({required Room room, String topic = 'lk.transcription', void registerHandler(String topic, TextStreamHandler handler)?, void unregisterHandler(String topic)?})
Properties
Methods
-
dispose(
) → Future< void> -
override
-
messages(
) → Stream< ReceivedMessage> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited