0d3cb498a3
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
3.7 KiB
3.7 KiB
provider-elevenlabs/alignment (ElevenLabs Forced Alignment)
Generate time-aligned subtitles (SRT/VTT) from audio and transcripts using ElevenLabs forced alignment.
Quick Start
npx promptfoo@latest init --example provider-elevenlabs/alignment
cd provider-elevenlabs/alignment
export ELEVENLABS_API_KEY=your_api_key_here
npx promptfoo@latest eval
What this tests
- Subtitle generation: Create SRT and VTT subtitle files
- Word-level alignment: Precise timestamp data for each word
- Multiple formats: JSON (raw data), SRT (video players), VTT (web players)
- Accuracy: Verify alignment matches audio timing
How it works
Forced alignment takes two inputs:
- Audio file: Speech recording (MP3, WAV, etc.)
- Transcript: Text of what was spoken
It returns precise timestamps showing when each word was spoken, formatted as subtitles.
Use Cases
- Video subtitles: Generate SRT files for video editing software
- Web captions: Create VTT files for HTML5 video players
- Karaoke apps: Word-level timing for synchronized highlighting
- Accessibility: Auto-generate captions for spoken content
- Translation sync: Time-align translations to original audio
Output Formats
JSON (Raw alignment data)
{
"alignment": [
{ "char": "T", "start": 0.0, "end": 0.1 },
{ "char": "h", "start": 0.1, "end": 0.15 }
],
"characters": "That's one small step..."
}
SRT (Standard video subtitles)
1
00:00:00,000 --> 00:00:02,500
That's one small step for man
2
00:00:02,500 --> 00:00:05,000
one giant leap for mankind
VTT (WebVTT for web players)
WEBVTT
1
00:00:00.000 --> 00:00:02.500
That's one small step for man
2
00:00:02.500 --> 00:00:05.000
one giant leap for mankind
Configuration
Basic alignment (JSON output)
providers:
- id: elevenlabs:alignment:json
label: Alignment (JSON)
tests:
- vars:
audioFile: path/to/audio.mp3
transcript: 'Your transcript text here'
format: json
SRT subtitles
providers:
- id: elevenlabs:alignment:srt
label: Alignment (SRT Subtitles)
tests:
- vars:
audioFile: path/to/audio.mp3
transcript: 'Your transcript text here'
format: srt
VTT subtitles
providers:
- id: elevenlabs:alignment:vtt
label: Alignment (VTT Subtitles)
tests:
- vars:
audioFile: path/to/audio.mp3
transcript: 'Your transcript text here'
format: vtt
Testing Assertions
tests:
# Verify alignment succeeds
- assert:
- type: javascript
value: output.includes('words') # JSON format
- type: not-contains
value: error
# Verify SRT format
- assert:
- type: javascript
value: output.includes('-->') && output.includes('small step')
Best Practices
- Transcript accuracy: Ensure transcript exactly matches spoken audio
- Include punctuation: Better subtitle chunking and timing
- Audio quality: Clear audio produces more accurate timestamps
- Format selection:
- Use SRT for video editing (Premiere, Final Cut, DaVinci)
- Use VTT for web players (HTML5
<video>tag) - Use JSON for custom processing
Cost Information
Forced alignment pricing is based on audio duration:
- ~$0.05 per minute of audio
The provider automatically tracks costs in evaluation results.
Related Examples
- ElevenLabs STT - Speech-to-text transcription
- ElevenLabs Isolation - Audio noise removal