Google GenAI `generateContentStream` aggregation silently drops `inlineData` output parts (images, audio)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
js/src/instrumentation/plugins/google-genai-plugin.ts の aggregateGenerateContentChunks から始め、part の処理を js/src/vendor-sdk-types/google-genai.ts の inlineData 宣言と比較します。既存の instrumentation チェックについては e2e/scenarios/google-genai-instrumentation/ を確認してください。ストリーミングされた inlineData パーツが集約された出力に保持され、画像またはその他のバイナリ出力を対象とするカバレッジがあれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The Google GenAI streaming aggregation code drops inlineData parts from the response output. When Gemini models generate images natively via generateContent with responseModalities: ['IMAGE'] (or return audio/other binary data), the inlineData parts in streamed chunks are silently lost because the aggregation loop does not handle them.
Non-streaming generateContent calls are unaffected — the plugin logs the full raw response as output.
What instrumentation is missing
In js/src/instrumentation/plugins/google-genai-plugin.ts, the aggregateGenerateContentChunks function (lines 749–778) processes parts from streamed chunks:
for (const part of candidate.content.parts) {
if (part.text !== undefined) {
// handled ✓
} else if (part.functionCall) {
// handled ✓
} else if (part.codeExecutionResult) {
// handled ✓
} else if (part.executableCode) {
// handled ✓
}
// inlineData → falls through, silently dropped ✗
}
The vendored type GoogleGenAIPart in js/src/vendor-sdk-types/google-genai.ts already declares the inlineData field (line 53), but the aggregation code never handles it. Any inlineData part in a streamed chunk is silently excluded from the aggregated output span.
Impact
- Native image generation via Gemini models (
gemini-2.0-flash, etc.) with streaming produces spans where generated images are missing from the output - Braintrust docs state "Streaming responses are fully supported — Braintrust automatically collects streamed chunks and logs the complete response as a single span," but this is not the case for image/audio output
- Users who stream
generateContentcalls withresponseModalities: ['IMAGE', 'TEXT']will see text in their spans but not the generated images
Braintrust docs status
unclear — Braintrust docs at https://www.braintrust.dev/docs/instrument/wrap-providers list @google/genai as supported and claim full streaming support, but do not specifically address image output in streamed responses.
Upstream reference
- Google GenAI native image generation: https://ai.google.dev/gemini-api/docs/image-generation
generateContentwithresponseModalities: ['IMAGE']returnsinlineDataparts containing generated images- This is a stable feature available on Gemini 2.0 Flash and later models
Local files inspected
js/src/instrumentation/plugins/google-genai-plugin.ts(lines 749–778:aggregateGenerateContentChunkspart processing loop)js/src/vendor-sdk-types/google-genai.ts(line 53:inlineDatafield onGoogleGenAIPart)js/src/wrappers/google-genai.ts(wrapper proxiesgenerateContentStreamto channel)e2e/scenarios/google-genai-instrumentation/(no test cases with image output in streamed responses)
Note
This is distinct from #1673 (models.generateImages() not instrumented), which covers the dedicated Imagen API. This issue is about the standard generateContent/generateContentStream API producing image output that gets lost specifically in the streaming aggregation path.
- 主要言語
- TypeScript
- スター
- 28
- フォーク
- 15
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 70
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
braintrustdata/braintrust-sdk-javascript のほかの issue
-
typescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2578 ·
メンテナーはふだん 1 日以内に返信
-
typescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2577 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2527 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 65/100
braintrustdata/braintrust-sdk-javascript#2526 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
braintrustdata/braintrust-sdk-javascript#2482 ·
メンテナーはふだん 1 日以内に返信
braintrustdata/braintrust-sdk-javascript の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
supadata-ai/mcp#27 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
capricorn86/happy-dom#2485 ·
メンテナーはふだん 2 日以内に返信
-
优化导入 OCR 模型选择文件的按钮样式オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
siyuan-note/siyuan#20430 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Albert-Weasker/niubigeo#194 ·
メンテナーはふだん 1 日以内に返信