A framework for evaluating multi-turn LLM conversations with support for text, realtime audio, and speech-to-speech models.
# Install dependencies
uv sync
# List available benchmarks
uv run multi-turn-eval list-benchmarks
# Run a benchmark. Results will be saved to runs/aiwf_medium_context/<timestamp>_<model_name>
uv run multi-turn-eval run aiwf_medium_context --model claude-sonnet-4-5 --service anthropic
# Judge the results
uv run multi-turn-eval judge runs/aiwf_medium_context/<timestamp>_claude-sonnet-4-5Requires Python 3.12+ and uv.
git clone <repo-url>
cd multi-turn-eval
uv syncSet the appropriate API keys for the services you want to use:
# Required for judging (Claude evaluates all benchmark results)
export ANTHROPIC_API_KEY=sk-ant-...
# Text-mode model services
export OPENAI_API_KEY=sk-... # OpenAI (GPT-4o, GPT-4o-mini, etc.)
export GOOGLE_API_KEY=... # Google (Gemini models)
export OPENROUTER_API_KEY=... # OpenRouter (access to multiple providers)
export GROQ_API_KEY=... # Groq
export CEREBRAS_API_KEY=... # Cerebras
# Speech-to-speech model services
export OPENAI_API_KEY=sk-... # OpenAI Realtime (gpt-realtime)
export GOOGLE_API_KEY=... # Gemini Live (gemini-native-audio)
export ULTRAVOX_API_KEY=... # Ultravox (ultravox-v0.7)
export XAI_API_KEY=... # xAI Grok Realtime (grok-realtime)
# AWS Nova models (text and speech-to-speech)
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=... # Optional: for temporary credentials
export AWS_REGION=us-east-1 # Optional: defaults to us-east-1You can also create a .env file in the project root with these variables.
# Basic usage with text model
uv run multi-turn-eval run <benchmark> --model <model> --service <service>
# Examples:
uv run multi-turn-eval run aiwf_medium_context --model claude-sonnet-4-5 --service anthropic
uv run multi-turn-eval run aiwf_medium_context --model gpt-4o --service openai
uv run multi-turn-eval run aiwf_medium_context --model gemini-2.5-flash --service google
# Realtime audio models
uv run multi-turn-eval run aiwf_medium_context --model gpt-realtime --service openai-realtime
uv run multi-turn-eval run aiwf_medium_context --model gemini-2.5-flash-native-audio-preview-12-2025 --service gemini-live
uv run multi-turn-eval run aiwf_medium_context --model ultravox-v0.7 --service ultravox-realtime
# Nova Sonic (no --service needed, pipeline creates its own LLM)
uv run multi-turn-eval run aiwf_medium_context --model amazon.nova-2-sonic-v1:0 --pipeline nova-sonic
# Grok (xAI) Realtime
uv run multi-turn-eval run aiwf_medium_context --model grok-realtime
# Debug with limited turns
uv run multi-turn-eval run aiwf_medium_context --model gpt-4o --service openai --only-turns 0,1,2
# Verbose logging
uv run multi-turn-eval run aiwf_medium_context --model gpt-4o --service openai --verboseAfter a benchmark run completes, judge the results using Claude:
# Judge a specific run
uv run multi-turn-eval judge runs/aiwf_medium_context/20251213T123456_claude-sonnet-4-5
# Judge with specific turns
uv run multi-turn-eval judge runs/aiwf_medium_context/20251213T123456_claude-sonnet-4-5 --only-turns 0,1,2
# Use a different judge model
uv run multi-turn-eval judge runs/aiwf_medium_context/20251213T123456_claude-sonnet-4-5 --judge-model claude-sonnet-4-5Judge outputs (saved to the run directory):
claude_summary.json- Score metricsclaude_analysis.md- Human-readable report with failuresclaude_judged.jsonl- Per-turn judgments with reasoning
For speech-to-speech model runs (OpenAI Realtime, Gemini Live, Ultravox, etc.), the judge automatically performs turn-taking analysis when a conversation.wav file is present. This adds a 4th evaluation dimension:
| Dimension | Description |
|---|---|
turn_taking |
Audio timing correctness (pre-computed from WAV analysis) |
tool_use_correct |
Function calls match expected |
instruction_following |
Response follows system prompt |
kb_grounding |
Facts match knowledge base |
Turn-taking failures are detected when:
- Missing timing data: No user speech detected before bot response
- Negative TTFB: Bot started speaking before user finished
- Empty response: Model returned only control tokens (e.g.,
<ctrl46>) - No response: Model never responded (15s timeout)
- Alignment drift: Audio tag positions drift >150ms from expected
- Audio overlap: User and bot speaking simultaneously
When turn-taking failures occur, the judge is more lenient on instruction_following since garbled audio may cause transcription issues.
# Judge a speech-to-speech run (turn-taking analysis runs automatically)
uv run multi-turn-eval judge runs/aiwf_medium_context/20260111T123456_gpt-realtime_abc123
# Skip turn-taking analysis
uv run multi-turn-eval judge runs/aiwf_medium_context/20260111T123456_gpt-realtime_abc123 --skip-turn-takingAdditional outputs for speech-to-speech runs:
claude_summary.jsonincludesturn_taking_failureslist andturn_taking_affected_instructioncountclaude_analysis.mdincludes Turn-Taking Analysis section with per-turn issuesclaude_judged.jsonlincludesturn_taking_issuesarray for failed turns
# List available benchmarks
uv run multi-turn-eval list-benchmarks
# List available pipelines
uv run multi-turn-eval list-pipelines
# List service aliases
uv run multi-turn-eval list-aliasesFor convenience, common service classes have short aliases:
| Alias | Service Class |
|---|---|
openai |
pipecat.services.openai.llm.OpenAILLMService |
openai-realtime |
pipecat.services.openai.realtime.llm.OpenAIRealtimeLLMService |
anthropic |
pipecat.services.anthropic.llm.AnthropicLLMService |
google |
pipecat.services.google.llm.GoogleLLMService |
gemini-live |
multi_turn_eval.pipelines.realtime.GeminiLiveLLMServiceWithReconnection |
bedrock |
pipecat.services.aws.llm.AWSBedrockLLMService |
ultravox-realtime |
pipecat.services.ultravox.llm.UltravoxRealtimeLLMService |
You can also use fully-qualified class names:
uv run multi-turn-eval run aiwf_medium_context \
--model gpt-4o \
--service pipecat.services.openai.llm.OpenAILLMServiceBenchmarks are located in benchmarks/. Each benchmark is a Python package with:
config.py- Benchmark configuration (turns, tools, system instruction)prompts/system.py- System prompt with knowledge basedata/knowledge_base.txt- Knowledge base content
| Benchmark | Description | Knowledge Base |
|---|---|---|
aiwf_long_context |
Long context benchmark | ~40K tokens |
aiwf_medium_context |
Medium context benchmark | ~12K tokens |
Both benchmarks share the same 30 turns, tools, and audio files. Only the knowledge base size differs.
| Pipeline | Use Case | Auto-Detection Pattern |
|---|---|---|
text |
Synchronous text LLMs | Default for all models |
realtime |
OpenAI Realtime, Gemini Live, Ultravox Realtime | *realtime*, *native-audio*, *live*, *ultravox* |
nova-sonic |
AWS Nova Sonic | *nova-sonic*, *nova_sonic* |
Runs are saved to runs/<benchmark>/<timestamp>_<model>/:
runs/
└── aiwf_medium_context/
└── 20251213T123456_claude-sonnet-4-5/
├── transcript.jsonl # Turn-by-turn results
├── runtime.json # Run metadata and metrics
├── run.log # Debug logs
├── claude_summary.json # Judge summary (after judging)
├── claude_judged.jsonl # Per-turn judgments (after judging)
└── claude_analysis.md # Human-readable analysis (after judging)
| Model | Pipeline | Service |
|---|---|---|
gpt-4o |
text | openai |
gpt-4o-mini |
text | openai |
gpt-realtime |
realtime | openai-realtime |
gemini-2.5-flash |
text | |
gemini-2.5-flash-native-audio-preview-12-2025 |
realtime | gemini-live |
ultravox-v0.7 |
realtime | ultravox-realtime |
claude-sonnet-4-5 |
text | anthropic |
claude-haiku-4-5 |
text | anthropic |
amazon.nova-2-sonic-v1_0 |
nova-sonic | (built-in) |
multi-turn-eval/
├── src/multi_turn_eval/ # Main package
│ ├── cli.py # CLI entry point
│ ├── pipelines/ # Pipeline implementations
│ │ ├── base.py # Abstract base pipeline
│ │ ├── text.py # Text pipeline
│ │ ├── realtime.py # Realtime pipeline (OpenAI/Gemini)
│ │ └── nova_sonic.py # Nova Sonic pipeline
│ ├── processors/ # Frame processors
│ │ ├── tool_call_recorder.py # Records tool calls
│ │ └── tts_transcript.py # TTS transcript handling
│ ├── transports/ # Input/output transports
│ │ ├── paced_input.py # Paced audio input
│ │ └── null_audio_output.py # Null audio sink
│ ├── recording/ # Transcript recording
│ │ └── transcript_recorder.py # Records transcripts
│ └── judging/ # Judge implementations
│ └── claude_judge.py # Claude-based judging
│
├── benchmarks/ # Benchmark definitions
│ ├── _shared/ # Shared benchmark data
│ │ ├── turns.py # 30 turns with golden data
│ │ ├── tools.py # Tool/function definitions
│ │ └── audio/ # Audio files for turns
│ ├── aiwf_long_context/ # Long context benchmark
│ └── aiwf_medium_context/ # Medium context benchmark
│
├── runs/ # Output directory (gitignored)
├── scripts/ # Utility scripts
└── pyproject.toml # Project configuration
To use a git branch of pipecat instead of the PyPI release, edit pyproject.toml:
[tool.uv.sources]
pipecat-ai = { git = "https://github.com/pipecat-ai/pipecat.git", rev = "main" }Then run uv sync to update.
The Claude judge evaluates each turn on three dimensions:
- tool_use_correct - Did the assistant call the expected function with correct arguments?
- instruction_following - Did the assistant answer the question or advance the task?
- kb_grounding - Is the response factually consistent with the knowledge base?
For detailed per-turn timing analysis of speech-to-speech models, use the comprehensive metrics script:
# Analyze a run with summary statistics
uv run python scripts/analyze_turn_metrics.py runs/aiwf_medium_context/<timestamp>_<model>
# Show per-turn breakdown table
uv run python scripts/analyze_turn_metrics.py runs/aiwf_medium_context/<timestamp>_<model> -v
# Output as JSON (for programmatic use)
uv run python scripts/analyze_turn_metrics.py runs/aiwf_medium_context/<timestamp>_<model> --jsonThe script consolidates timing data from multiple sources and calculates the following metrics:
| Metric | Description | Calculation |
|---|---|---|
| Server TTFB | Time from request to first byte from model | Read from transcript.jsonl (reported by Pipecat) |
| Pipeline TTFB | Time from user speech end to bot audio tag | bot_tag_log_ms - user_end_ms (Silero VAD) |
| WAV V2V | Voice-to-voice latency measured from audio | bot_silero_start_ms - user_end_ms (Silero VAD) |
| Silent Pad (RMS) | Silent padding before speech (RMS detection) | bot_rms_onset_ms - bot_tag_log_ms |
| Silent Pad (VAD) | Silent padding before speech (Silero VAD) | bot_silero_start_ms - bot_tag_wav_ms |
| Tag Alignment | Drift between log position and WAV detection | bot_tag_log_ms - bot_tag_wav_ms |
Key metric relationships:
- WAV V2V = Pipeline TTFB + Silent Pad (VAD) - The total voice-to-voice latency includes both the time waiting for audio to arrive and any initial silence in the audio stream
- Pipeline TTFB measures when audio starts arriving at the pipeline
- Silent Pad measures how much silence is at the beginning of the audio (most models send 40-120ms of silence before speech)
The script verifies that log-based timestamps match actual audio positions by detecting audio tags (2kHz tones) embedded in the WAV file:
- Bot tags: Inserted when bot audio arrives at the pipeline
- Alignment OK: Log and WAV positions match within ±20ms tolerance
- Issues detected: Missing tags, extra tags, or drift outside tolerance
When run with --json, the script outputs structured data that can be saved:
# Save metrics to JSON file
uv run python scripts/analyze_turn_metrics.py runs/aiwf_medium_context/<timestamp>_<model> --json > turn_metrics.jsonUse this prompt with Claude Code to run comprehensive benchmarks across multiple speech-to-speech models:
Run a full 30-turn test with all four speech-to-speech models: ultravox-v0.7,
gpt-realtime, grok-realtime, gemini-2.5-flash-native-audio-preview-12-2025.
For each model:
1. Run the 30-turn benchmark
2. Analyze using scripts/analyze_turn_metrics.py and save turn_metrics.json
3. Judge the model performance using the Claude judge
After completing all models, create a summary comparison table with these columns:
- Model
- Tool Use (X/30)
- Instruction (X/30)
- KB Ground (X/30)
- Turn Ok (X/30)
- Pass Rate
- Non-Tool V2V Median
- Non-Tool V2V Max
- Tool V2V Mean
- Silence Pad Mean
Separate metrics for tool-call turns vs non-tool-call turns in the analysis.
This will run all four models (which takes approximately 15-20 minutes each), analyze their timing metrics, judge their responses, and produce a comparison table.
MIT