Skip to content

Conversation

@itskyf
Copy link
Contributor

@itskyf itskyf commented Jan 8, 2026

This PR refactors the Amazon Transcribe STT plugin to improve session stability, and billing efficiency.

Changes & Improvements

  • Audio Keep-Alive:
    • Old behavior: Let the stream time out after 15s of silence, incurring reconnection latency and repeated minimum 15-second billing charges.
    • New behavior: Sends silent PCM frames every 10s to maintain a long-lived session, ensuring instant response and better cost efficiency.
  • Replaced asyncio.gather with asyncio.TaskGroup: if either the send or receive loop fails for safer cleanup (please check the below notes).
  • Moved the audio iterator outside the retry loop. If a network error occurs, the plugin reconnects without "forgetting" the buffered audio.

Notes

  • I removed runtime dependency checks, as the aws_sdk_transcribe_streaming SDK already requires Python 3.12+.
  • I have tested this implementation for 2 weeks, no error so far.

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.

1 participant