Replace callback-based audio streaming with iterator pattern#597
Merged
baijumeswani merged 2 commits intomainfrom Apr 6, 2026
Merged
Replace callback-based audio streaming with iterator pattern#597baijumeswani merged 2 commits intomainfrom
baijumeswani merged 2 commits intomainfrom
Conversation
…backs Agent-Logs-Url: https://github.com/microsoft/Foundry-Local/sessions/eca3ed88-a012-4994-9ab4-f7cf86e4cf65 Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
baijumeswani
April 6, 2026 06:05
View session
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the Python AudioClient.transcribe_streaming API with the SDK’s iterator-based streaming pattern (matching ChatClient.complete_streaming_chat) by switching from a required callback to a returned generator.
Changes:
- Refactor
transcribe_streamingto return aGenerator[AudioTranscriptionResponse]backed by a background thread + queue + sentinel. - Update audio streaming tests to consume streaming output via
for chunk in ...and remove the invalid-callback test. - Update Python test suite README test counts to reflect the removed test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/python/src/openai/audio_client.py | Replaces callback-based streaming with a generator-based streaming implementation using a thread/queue pattern. |
| sdk/python/test/openai/test_audio_client.py | Updates streaming tests to iterate over the generator; removes callback validation test. |
| sdk/python/test/README.md | Updates listed audio/total test counts after removing one test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
prathikr
approved these changes
Apr 6, 2026
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.
AudioClient.transcribe_streamingrequired a callback argument, inconsistent withChatClient.complete_streaming_chatwhich returns aGenerator. Align the audio client to the same iterator pattern used across the SDK.Changes
audio_client.py: Replacetranscribe_streaming(path, callback) -> Nonewithtranscribe_streaming(path) -> Generator[AudioTranscriptionResponse]using the samethreading.Thread+queue.Queue+ sentinel pattern fromChatClient._stream_chunkstest_audio_client.py: Update streaming tests tofor chunk inconsumption; removetest_should_raise_for_streaming_invalid_callback(no longer applicable)test/README.md: Update test counts (7→6 audio, 32→31 total)Usage