-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Replaced deprecated amazon-transcribe SDK with new aws-sdk-transcribe-streaming #4111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-streaming - Replace `amazon-transcribe` dependency with `aws_sdk_transcribe_streaming` in pyproject.toml - Bump minimum Python version to 3.12, as requried by the official AWS SDK. - Update `STT` implementation to use the new SDK client and models. - Refactor `SpeechStream._run` to use `TranscribeStreamingClient` from the new SDK. - Update audio input streaming to use `AudioStreamAudioEvent`. - Update transcript event processing to match the new SDK's event structure. - Remove custom credential resolver logic in favor of `EnvironmentCredentialsResolver`
Prevent race conditions and unhandled exceptions during participant disconnects: Changes: - Implement a graceful shutdown sequence: close input stream first, then wait for output stream to finish. - Use `asyncio.shield` to protect inner tasks from immediate cancellation, allowing for proper cleanup. - Suppress `concurrent.futures.InvalidStateError` in `handle_transcript_events` to avoid noise from AWS CRT bindings during shutdown. - Ensure `gather_future` is awaited to prevent "exception never retrieved" warnings. - Use `contextlib.suppress` for cleaner exception handling during resource cleanup.
|
Unit test I don't think this has anything to do with the changes in my PR. |
longcw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating the pr! Looks good to me, something nit:
longcw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
The AWS Python SDK used by livekit-plugins-aws in the STT implementation (
amazon-transcribe) has known critical CPU bottleneck performance issues and has been deprecated by AWS in favor ofaws-sdk-transcribe-streaming.amazon-transcribeissue: [Bug] BufferableByteStream causes 100% CPU usage in non-blocking scenarios awslabs/amazon-transcribe-streaming-sdk#121livekit/agentsissue: AWS STT plugin extremely slow when using multi-user transcription #3739This PR replaces the old, deprecated, low-performance AWS SDK with the new official AWS SDK. I have tested the problematic scenario explained in this issue (#3739) and it is no longer a problem when using this PR. Transcribing multiple users from the same LiveKit Agent using livekit-plugin-aws STT is now possible, with no delays. The scope of the commit is quite small, so I do not expect any significant side effects.