Overview
Recording transcripts of conversations between users and your bot is useful for debugging, analysis, and creating a record of interactions. Pipecat’s turn events make it easy to collect both user and assistant messages as they occur.How It Works
Transcripts are collected using turn events on the context aggregators:- Capturing what the user says via
on_user_turn_stopped - Capturing what the assistant says via
on_assistant_turn_stopped - Each event provides the complete transcript for that turn
- Allowing you to handle these events with custom logic
Turn events are emitted by the context aggregators (
LLMUserAggregator and
LLMAssistantAggregator), which are created as part of the
LLMContextAggregatorPair.Basic Implementation
Step 1: Create Context Aggregators
First, create the context aggregator pair and get references to both aggregators:Step 2: Add to Your Pipeline
Include the aggregators in your pipeline:Step 3: Handle Turn Events
Register event handlers to capture transcripts when turns complete:Next Steps
Turn Events Reference
Learn about all available turn events and their parameters.
Transcriptions Reference
See more examples for collecting and processing transcriptions.