Skip to content

feat(#3996): stream model-generated media deltas - #4023

Draft
aheritier wants to merge 1 commit into
gemini-gateway-transportfrom
generated-media-streaming
Draft

feat(#3996): stream model-generated media deltas#4023
aheritier wants to merge 1 commit into
gemini-gateway-transportfrom
generated-media-streaming

Conversation

@aheritier

@aheritier aheritier commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

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 test

Invoke 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.

@aheritier aheritier added area/providers/gemini Google Gemini provider support area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Aug 22, 2026
@aheritier
aheritier force-pushed the generated-media-streaming branch from fc76f6a to 79f0624 Compare August 24, 2026 15:13
@aheritier
aheritier force-pushed the generated-media-streaming branch from 79f0624 to 99aa451 Compare August 25, 2026 07:59
@aheritier
aheritier force-pushed the generated-media-streaming branch from 99aa451 to 1d9a86b Compare August 25, 2026 20:24
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.
@aheritier
aheritier force-pushed the generated-media-streaming branch from 1d9a86b to 1d2122c Compare August 26, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/providers/gemini Google Gemini provider support area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant