Repository navigation
feat(sync): push-style live sessions via open_live() - #244
Merged
ccampbell-aai merged 1 commit intoSep 10, 2026
Merged
Conversation
ccampbell-aai
force-pushed
the
ccampbell/sync-live-session
branch
from
September 9, 2026 21:17
862d166 to
7fcb51e
Compare
ccampbell-aai
marked this pull request as ready for review
September 9, 2026 21:23
transcribe_live() takes an iterator, but most live audio arrives in a callback: sounddevice, PyAudio, WebRTC tracks, telephony media streams, websocket frame handlers. Every such caller had to build the same bridge (a queue, a stop flag, a drain generator and, on the sync side, a thread to run the blocking call in) before getting a transcript. SyncTranscriber.open_live() returns a LiveSession and AsyncSyncTranscriber.open_live() an AsyncLiveSession. The request starts the moment the session opens, on the transcriber's worker pool or as a loop task; write() queues audio without blocking (thread-safe on the sync side), close() ends it, result() waits for the transcript, and abort() drops the request. Context-manager exit closes on success and aborts if the block raised. Chunk types are validated at write() so a str shows up immediately rather than in result(). Both sessions are thin layers over transcribe_live(): no new transport code, same errors, same 120 s cap and silence-abort semantics. The iterator form stays for sources that already are iterators or file objects. README leads the live examples with the session now (sounddevice, and a websocket handler for asyncio), and keeps transcribe_live() for iterator and file-object sources. 19 tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ccampbell-aai
force-pushed
the
ccampbell/sync-live-session
branch
from
September 10, 2026 16:51
3334c19 to
780dd73
Compare
aurpsis-aai
added this pull request to stack #248
September 10, 2026 18:19
aurpsis-aai
approved these changes
Sep 10, 2026
ccampbell-aai
force-pushed
the
ccampbell/sync-live-session
branch
from
September 10, 2026 18:23
780dd73 to
6df7cbf
Compare
aurpsis-aai
approved these changes
Sep 10, 2026
ccampbell-aai
added a commit
that referenced
this pull request
Sep 10, 2026
…ell/dictation-sdk Keeps the shared _audio helpers for sync's _resolve_audio and adds master's resolve_format() as a wrapper over _audio.resolve_format so stream_filename() keeps its helper; merges the typing imports in sync/v1/api.py; keeps both sync_live_http_timeout and the dictation settings. Version to 1.7.0 on top of master's 1.6.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ccampbell-aai
added a commit
that referenced
this pull request
Sep 10, 2026
…ell/dictation-sdk Keeps the shared _audio helpers for sync's _resolve_audio and adds master's resolve_format() as a wrapper over _audio.resolve_format so stream_filename() keeps its helper; merges the typing imports in sync/v1/api.py; keeps both sync_live_http_timeout and the dictation settings. Version to 1.7.0 on top of master's 1.6.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #241, which now carries the
transcribe_live()rename and README examples. This PR adds only the push-style session on top.Why
transcribe_live()takes an iterator, but most live audio arrives in a callback: sounddevice, PyAudio, WebRTC tracks, telephony media streams, websocket frame handlers. Every such caller had to build the same bridge before getting a transcript: a queue, a stop flag, a drain generator and, on the sync side, a thread to run the blocking call in. That bridge is the same thirty-odd lines in every application, and none of it is the application's job.What
SyncTranscriber.open_live(config) -> LiveSession;AsyncSyncTranscriber.open_live(config) -> AsyncLiveSession. Both exported fromassemblyai.sync.v1.write(chunk)queues audio and never blocks. Thread-safe on the sync side; on the async side it is a plain function so a callback can call it, and must run on the loop thread (loop.call_soon_threadsafe(session.write, chunk)from elsewhere). Chunk types are validated atwrite()so astrsurfaces immediately rather than inresult().close()ends the audio;result()waits for the transcript (closing first if needed);abort()drops the request. Context-manager exit closes on success and aborts if the block raised.transcribe_live(): no new transport code, same errors, same 120 s cap and silence-abort semantics. The iterator form stays for sources that already are iterators or file objects.Abort works by having the producer raise a private exception, which propagates out of httpx and drops the connection;
abort()swallows it. Afterclose()the upload is already complete, so an abort then waits out the in-flight response (documented).README now leads the live examples with the session (sounddevice, and a websocket handler for asyncio) and keeps
transcribe_live()for iterator and file-object sources.Validation
transcribe()on the same PCM, with the post-speech wait cut to roughly a third; a mid-uploadabort()returns immediately and drops the request.No version bump: this stacks on #241 and inherits its version, so it carries the
skip-version-bumplabel. The test matrix and version-bump workflows only trigger for PRs into master, so only lint runs here until the base moves.🤖 Generated with Claude Code