feat(#3996): stream model-generated media deltas - #4023
Draft
aheritier wants to merge 1 commit into
Draft
Conversation
Extend the shared chat.MessageDelta streaming representation with typed MediaDelta entries (bytes + MIME + name + size) so generated binary media has a provider-agnostic path instead of a Gemini-only side channel. The Gemini adapter captures inline image blobs from response candidates the same way it already captures text/reasoning/tool calls/usage — retaining every blob in a chunk, not just the last — and the run() content gate forwards image-only chunks that previously would have been dropped. The runtime's stream accumulator (pkg/runtime/streaming.go) collects the deltas into streamResult.Media, accumulating before any terminal check so a final chunk that carries both media and a finish reason is never lost. Persistence of the accumulated media ships in the follow-up materialization commits.
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.
What
Streams model-generated media deltas through Gemini adaptation, runtime streaming, chat media types, and tests.
Why
Generated media should become available incrementally rather than waiting for the entire response.
Validation
task test; Gemini adapter and runtime streaming tests.Test instructions
Run:
task testInvoke a media-generating model and observe the chat stream. Expected: generated-media deltas arrive in order as they are received, are represented by the chat stream, and do not require waiting for the complete response.