Overview
TheTranscriptProcessor
is a factory class that creates and manages processors for handling conversation transcripts from both users and assistants. It provides unified access to transcript processors with shared event handling, making it easy to track and respond to conversation updates in real-time.
The processor normalizes messages from various sources into a consistent TranscriptionMessage
format and emits events when new messages are added to the conversation.
Constructor
Methods
user()
TranscriptionFrame
s from STT services.
Parameters:
**kwargs
: Arguments passed to theUserTranscriptProcessor
constructor
UserTranscriptProcessor
instance for processing user messages.
assistant()
TTSTextFrame
s from TTS services and aggregates them into complete utterances.
Parameters:
**kwargs
: Arguments passed to theAssistantTranscriptProcessor
constructor
AssistantTranscriptProcessor
instance for processing assistant messages.
event_handler()
event_name
: Name of the event to handle
Event Handlers
on_transcript_update
Triggered when new messages are added to the conversation transcript.processor
: The specific processor instance that emitted the event (UserTranscriptProcessor or AssistantTranscriptProcessor)frame
:TranscriptionUpdateFrame
containing the new messages
Data Structures
TranscriptionMessage
role
: The message sender type (“user” or “assistant”)content
: The transcribed text contenttimestamp
: ISO 8601 timestamp when the message was createduser_id
: Optional user identifier (for user messages only)
TranscriptionUpdateFrame
Frame containing new transcript messages, emitted by theon_transcript_update
event.
Properties:
messages
: List ofTranscriptionMessage
objects containing the new transcript content
Frames
UserTranscriptProcessor
- Input:
TranscriptionFrame
from STT services - Output:
TranscriptionMessage
with role “user”
AssistantTranscriptProcessor
- Input:
TTSTextFrame
from TTS services - Output:
TranscriptionMessage
with role “assistant”