Skip to content

Add transcript_edit to the realtime speech-to-text wrapper - #871

Merged
kraenhansen merged 2 commits into
mainfrom
jacek/scribe-transcript-edit
Sep 24, 2026
Merged

kraenhansen merged 2 commits into
mainfrom
jacek/scribe-transcript-edit

Conversation

@JacekDuszenko

Copy link
Copy Markdown
Contributor

Adds the transcript_edit option to client.speech_to_text.realtime.connect() (both RealtimeAudioOptions and RealtimeUrlOptions) and the RealtimeEvents.EDITED_TRANSCRIPT event, following the pattern of #830 (entity detection).

  • transcript_edit: str: natural-language instruction applied to each committed transcript (max 2000 characters), sent as the transcript_edit query param. Cannot be combined with entity_detection; the server rejects the combination with invalid_request.
  • New server message edited_transcript → RealtimeEvents.EDITED_TRANSCRIPT, carrying text (the committed text the instruction was applied to) and edited_text (identical to text if no edits were made). Edits run asynchronously and may arrive out of commit order, so text is the field to correlate on. Dispatch is by enum value, so adding the member is what routes the message.
  • Tests: the exhaustive URL-builder and connect() tests cover transcript_edit; dispatch tests cover the new event.
  • Version bumped to 2.69.0 (pyproject.toml, client_wrapper headers), as Add missing realtime speech-to-text options #830 did. Happy to drop that if releases are cut differently now.

Upstream: the parameter and event ship in elevenlabs/xi#49618 (websocket route) and elevenlabs/xi#51266 (public AsyncAPI spec); docs in elevenlabs/elevenlabs-dx#2778; JS counterpart in elevenlabs/elevenlabs-js (same branch name); client SDK in elevenlabs/packages#1023. Pricing: 30% premium on the base transcription cost, billed for at least 10 seconds of audio per committed transcript.

Verified locally: ruff check clean, mypy src/elevenlabs/realtime clean, pytest tests/test_stt_realtime.py 33 passed.

🤖 Generated with Claude Code

Adds the transcript_edit option to both realtime connection modes, sent as
the transcript_edit query param, and the RealtimeEvents.EDITED_TRANSCRIPT
event so the new edited_transcript server message reaches subscribers.
Bumps the SDK version to 2.69.0, following the convention of #830.
@JacekDuszenko
JacekDuszenko force-pushed the jacek/scribe-transcript-edit branch from 49e091f to f3ea731 Compare September 21, 2026 19:17
@JacekDuszenko
JacekDuszenko marked this pull request as ready for review September 23, 2026 16:01
@cursor

cursor Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Additive optional realtime STT API surface with tests; server enforces mutual exclusion with entity_detection and billing rules.

Overview
Adds transcript_edit to realtime speech-to-text connect options: a natural-language instruction (up to 2000 chars) forwarded as a WebSocket query param so the service can post-process each committed segment and emit results separately from entity detection.

Introduces RealtimeEvents.EDITED_TRANSCRIPT (edited_transcript messages with text and edited_text); routing follows the existing pattern where new enum values map message_type to handlers. Shared options, handshake payload, and URL building all accept the new field.

Tests extend exhaustive URL/connect() coverage and add dispatch coverage for the new event, including the committed vs edited text payload.

Reviewed by Cursor Bugbot for commit 782f6af. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/elevenlabs/core/client_wrapper.py Resolved
Comment thread pyproject.toml Resolved
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kraenhansen
kraenhansen merged commit 916322f into main Sep 24, 2026
4 checks passed
@kraenhansen
kraenhansen deleted the jacek/scribe-transcript-edit branch September 24, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants