Factory for creating and managing conversation transcript processors with shared event handling
TranscriptProcessor
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.
TranscriptionFrame
s from STT services.
Parameters:
**kwargs
: Arguments passed to the UserTranscriptProcessor
constructorUserTranscriptProcessor
instance for processing user messages.
TTSTextFrame
s from TTS services and aggregates them into complete utterances.
Parameters:
**kwargs
: Arguments passed to the AssistantTranscriptProcessor
constructorAssistantTranscriptProcessor
instance for processing assistant messages.
event_name
: Name of the event to handleprocessor
: The specific processor instance that emitted the event (UserTranscriptProcessor or AssistantTranscriptProcessor)frame
: TranscriptionUpdateFrame
containing the new messagesrole
: 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)on_transcript_update
event.
Properties:
messages
: List of TranscriptionMessage
objects containing the new transcript contentTranscriptionFrame
from STT servicesTranscriptionMessage
with role “user”TTSTextFrame
from TTS servicesTranscriptionMessage
with role “assistant”