refactor: consolidate __init__, _build_stream_metadata, _parse_output into base Stream#172
Merged
Kamilbenkirane merged 1 commit intomainfrom Feb 23, 2026
Conversation
… into base Stream (#169) Move three duplicated methods from TextStream, ImagesStream, and AudioStream into the base Stream class: - __init__: absorb transform_output and stream_metadata params (replaces client ref) - _build_stream_metadata: base now merges stream_metadata dict with raw_events - _parse_output: concrete default using new _aggregate_content abstract + _output_class ClassVar Also convert _map_output_format_to_mime_type to @staticmethod on ElevenLabs/Gradium provider mixins since the stream no longer holds a client reference. ~140 lines removed across 12 files with zero behavioral changes.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This was referenced Feb 24, 2026
Merged
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.
Summary
Closes #169
__init__,_build_stream_metadata, and_parse_outputfromTextStream,ImagesStream, andAudioStreaminto the baseStreamclassclient=selfwithstream_metadata={...}dict — streams no longer hold a client reference_output_classClassVar and abstract_aggregate_contentto baseStream_map_output_format_to_mime_typeto@staticmethodon ElevenLabs/Gradium provider mixins (pure functions that never usedself)_aggregate_content)~115 net lines removed across 12 files with zero behavioral changes.
Test plan
pytest tests/unit_tests/test_streaming.py— 30 base streaming tests passpytest tests/unit_tests/test_stream_metadata_from_response_data.py— 4 metadata tests passpytest tests/unit_tests/— full 474 unit tests passself._client,client=, orModalityClientreferences in stream contexts