TranscriptProcessor
- class pipecat.processors.transcript_processor.BaseTranscriptProcessor(**kwargs)[source]
Bases:
FrameProcessor
Base class for processing conversation transcripts.
Provides common functionality for handling transcript messages and updates.
- class pipecat.processors.transcript_processor.UserTranscriptProcessor(**kwargs)[source]
Bases:
BaseTranscriptProcessor
Processes user transcription frames into timestamped conversation messages.
- async process_frame(frame, direction)[source]
Process TranscriptionFrames into user conversation messages.
- Parameters:
frame (Frame) – Input frame to process
direction (FrameDirection) – Frame processing direction
- class pipecat.processors.transcript_processor.AssistantTranscriptProcessor(**kwargs)[source]
Bases:
BaseTranscriptProcessor
Processes assistant TTS text frames into timestamped conversation messages.
This processor aggregates TTS text frames into complete utterances and emits them as transcript messages. Utterances are completed when: - The bot stops speaking (BotStoppedSpeakingFrame) - The bot is interrupted (StartInterruptionFrame) - The pipeline ends (EndFrame)
- _current_text_parts
List of text fragments being aggregated for current utterance
- _aggregation_start_time
Timestamp when the current utterance began
- async process_frame(frame, direction)[source]
Process frames into assistant conversation messages.
Handles different frame types: - TTSTextFrame: Aggregates text for current utterance - BotStoppedSpeakingFrame: Completes current utterance - StartInterruptionFrame: Completes current utterance due to interruption - EndFrame: Completes current utterance at pipeline end - CancelFrame: Completes current utterance due to cancellation
- Parameters:
frame (Frame) – Input frame to process
direction (FrameDirection) – Frame processing direction
- class pipecat.processors.transcript_processor.TranscriptProcessor[source]
Bases:
object
Factory for creating and managing transcript processors.
Provides unified access to user and assistant transcript processors with shared event handling.
Example
```python transcript = TranscriptProcessor()
- pipeline = Pipeline(
- [
transport.input(), stt, transcript.user(), # User transcripts context_aggregator.user(), llm, tts, transport.output(), transcript.assistant_tts(), # Assistant transcripts context_aggregator.assistant(),
]
)
@transcript.event_handler(“on_transcript_update”) async def handle_update(processor, frame):
print(f”New messages: {frame.messages}”)
- user(**kwargs)[source]
Get the user transcript processor.
- Parameters:
**kwargs – Arguments specific to UserTranscriptProcessor
- Return type:
UserTranscriptProcessor
- assistant(**kwargs)[source]
Get the assistant transcript processor.
- Parameters:
**kwargs – Arguments specific to AssistantTranscriptProcessor
- Return type:
AssistantTranscriptProcessor
- event_handler(event_name)[source]
Register event handler for both processors.
- Parameters:
event_name (str) – Name of event to handle
- Returns:
Decorator function that registers handler with both processors