Add StreamingTranscriptionClient for streaming from any source - #480
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new StreamingTranscriptionClient to let callers stream raw PCM audio chunks from arbitrary sources (backend streams, pipelines, etc.) into WhisperLive, and receive partial vs committed transcripts via dedicated callbacks. It also adds documentation and an example script to demonstrate manual chunking.
Changes:
- Added
StreamingTranscriptionClient(and internal_HookedClient) to support manual PCM chunk streaming with callbacks for partial/committed transcripts. - Documented the new streaming client usage and callbacks in
README.md. - Added
examples/manual_audio_chunking.pydemonstrating file-to-chunk streaming into the server.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| whisper_live/client.py | Adds _HookedClient and StreamingTranscriptionClient for manual audio chunk streaming + callback dispatch. |
| README.md | Documents the new streaming client API and provides usage examples. |
| examples/manual_audio_chunking.py | Demonstrates chunked audio streaming and printing partial/committed output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Kokkini can you please address the comments from copilot review and resolve the merge conflicts as well? |
|
Ok, I'll do that later today |
296b69b to
ec1dc7c
Compare
|
@makaveli10 I addressed the comments and rebased to resolve the merge conflicts. |
Thanks for this awesome repo. I'm using it in one of my production web apps. I did this PR because I had the following issues:
completedflag on segments wasn't documented, making it hard to distinguish in-progress (partial) from finalized (committed) transcripts without digging into the source. I was confused for some time.I solved those for my use case by implementing my own client class. I thought others would benefit from the ability to transcribe an audio stream from anywhere (for example, a frontend, a backend, a processed stream — not just a file or live mic). Thus, I made this PR.
StreamingTranscriptionClientthat supports streaming from any audio source with the simple interface ofclient.send(chunk)and callbacks to receive results.on_partial_transcriptandon_committed_transcriptto make the partial/committed distinction explicit and easy to use.examples/manual_audio_chunking.pyto show how to use the new client, and document it in the README._HookedClientis an internal subclass used byStreamingTranscriptionClientand is not part of the public API.I intentionally made no changes to the server or the existing client classes so this is as non-disruptive as possible.
Let me know if this helps or anything needs to be changed.