docs(examples): add resilient live transcription reconnection example - #776
Merged
Conversation
Adds examples/17-transcription-live-reconnect.py demonstrating the resilience patterns recommended for production streaming STT: exponential backoff with full jitter and a retry cap, reconnect-worthy close codes distinguished from normal/fatal closure, audio buffered across the disconnect gap and resumed on reconnect, original connection options re-applied, continuous timestamps across sessions, and clean shutdown via CloseStream. Includes a demo-only fault injector that severs the TCP socket mid-stream to show recovery; validated live against api.deepgram.com. Also lists the previously missing example 16 in examples/README.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dg-coreylweathers
requested review from
GregHolmes and
deepgram-kiley
as code owners
August 31, 2026 13:30
Contributor
|
GregHolmes
approved these changes
Sep 2, 2026
Closed
8 tasks
GregHolmes
added a commit
that referenced
this pull request
Sep 3, 2026
🤖 I have created a release *beep* *boop* --- ## [7.8.1](v7.8.0...v7.8.1) (2026-09-03) ### Bug Fixes * **TextBuilder:** `ssml_to_deepgram()` now preserves a `<phoneme>` pronunciation when its valid `ph` and `alphabet` attributes appear in either order. ([#741](#741)) ([7fd4b63](7fd4b63)) * **Credentials:** Explicitly passing `api_key=None` continues to disable ambient `DEEPGRAM_API_KEY` lookup, which is important for multi-tenant and test environments. ([#778](#778)) ([e675990](e675990)) * **Credentials:** `DeepgramClient()` and `AsyncDeepgramClient()` now resolve `DEEPGRAM_API_KEY` when constructed, so `load_dotenv()` can run after importing the SDK. Closes [#734](#734). ([#767](#767)) ([ec362ec](ec362ec)) * **Custom transports:** Speak V2 WebSocket connections now honor `transport_factory`, matching the routing behavior of other WebSocket APIs for proxies, test doubles, and custom-hosted transports. ([#766](#766)) ([0980663](0980663)) ### Documentation * **Transcription:** Clarified that Nova-3 assumes English when `language` is omitted; non-English and multilingual audio require an explicit language such as `fr` or `multi`. ([#771](#771)) ([4574337](4574337)) * **Examples:** Added Listen V1 live microphone transcription with optional `sounddevice`, device selection, bounded audio buffering, transcript output, and clean Ctrl-C shutdown. ([#780](#780)) ([08f0471](08f0471)) * **Examples:** Added a resilient Listen V1 live transcription pattern with exponential backoff, reconnect-aware audio buffering, timestamp continuity, and clean shutdown. ([#776](#776)) ([96b2d11](96b2d11)) * **Examples:** Added an application-owned Voice Agent session recorder that serializes received transcripts, function calls, and latency reports as JSON while leaving consent, redaction, retention, and storage policy to the application. Closes [#775](#775). ([#781](#781)) ([30ad152](30ad152)) * **Text-to-Speech:** Corrected streaming synthesis snippets to iterate the response byte chunks instead of accessing a nonexistent `.stream` attribute. ([#749](#749)) ([178724e](178724e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Greg Holmes <greg.holmes@deepgram.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.
What
Adds
examples/17-transcription-live-reconnect.py, a production-oriented reconnection example for streaming speech-to-text that will back the upcomingspeech-to-text/streaming/guides/productiondocs page. Also adds the previously missing README entry for example 16.What it demonstrates
SIMULATE_DROP=1) that severs the TCP socket mid-stream to demonstrate recoveryUses only this SDK's Listen V1 socket client; every method and event name is verified against source.
Validation
1007 passed, 1 skippedRelated finding
The bad-key probe surfaced a pre-existing SDK compatibility issue:
core/websocket_compat.pymay bind legacyInvalidStatusCodewhile sync clients raise distinctInvalidStatuson rejected WebSocket handshakes in some supportedwebsocketsversions. This example handles both shapes; the SDK-wide generator versus hand-patch decision remains separate from this example.