System One: carry audio to Google's gemini-decision-1
What you want to do
Send audio to google/gemini-decision-1 through /v1/systemone, not only text and images. Video and PDF blocks would use the same shape later.
What you do today instead
Only images is carried. googleAsk builds the input from text and images, and there is no field for audio, so an audio-only classifier has to call Google directly and loses magpie's keys, routing and quota handling.
Google's Decisions API accepts an audio block, and I checked it directly: a 3.8 s WAV sent as {"type":"audio","data":"…","mime_type":"audio/wav"} came back with 242 input tokens (116 of them audio) and the answer at 0.95 confidence.
Suggested shape: an audio array next to images, with the same data-URL or URL strings, translated to audio blocks in googleAsk.
No client sends audio today: Pi's ClassifierContext has images only. This is forward-looking, so it can wait until a caller exists. It would keep the wire in one place and let Pi pass audio later without another change.
Fix branch: https://github.com/qq01-hub/magpie/tree/fix/systemone-google-audio (59c6198b4)
Compare: https://github.com/yetone/magpie/compare/main...qq01-hub:magpie:fix/systemone-google-audio
Changes:
- Extend
googleAskininternal/provider/decide_wire.goto translate a System One request'saudioarray (base64data:URLs or URIs) into Google Decisions API{"type":"audio",...}content blocks via shared helpergoogleMediaBlock, stripping optional data-URL parameters (e.g.;codecs=opus) formime_type. - Support audio-only classification requests (omitted or empty-string
state) without inserting an empty text block, support combiningimagesandaudioin the same request, and strip emptyaudio: []arrays so no unknown top-levelaudiokey reaches Google. - Keep non-Google wires (
ViaSystemOne,ViaVercel, etc.) untouched; OpenAI/v1/decisionstranslation continues rejecting unsupportedaudiocleanly viasystemOneAsDecisions. - Add unit coverage in
TestGoogleDecideWire(internal/provider/decide_google_test.go) and end-to-end/v1/systemonecoverage inTestGoogleSystemOneTakesAudio(internal/gateway/decide_google_test.go).
Verification (Windows 11 amd64, Go 1.26.8):
- Before fix:
TestGoogleDecideWirefailed (top-levelaudioleaked untouched) andTestGoogleSystemOneTakesAudiofailed with 400 on audio-only input. - After fix:
go test -count=5 ./internal/provider -run 'TestGoogleDecide|TestDecide'(35/35) andgo test -count=5 ./internal/gateway -run 'TestGoogleSystemOne|TestGoogleDecisions|TestSystemOne|TestDecide|TestDecisions'(145/145) passed;go vetpassed on Windows, Linux (-tags nogui), and macOS (-tags nogui).
Verified on 0.1.4839: a 3.8 s WAV in audio returns 200 with 242 input tokens, the same count as calling Google directly, noul 0.954.
@yetone 佬,这个 issue 的修复分支我这边修完推在 qq01-hub/magpie 上了(fix/systemone-google-audio),报告者 et84121 已在 0.1.4839 上验证通过,改动说明和跑过的测试都在上面的回复里,有空帮忙瞅一眼哈。