fix(call_runner): stop asking apps for JSON - #52
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b9b24b2 to
5483803
Compare
47cd45d to
88cdbb8
Compare
|
Thanks, I'm trying to remember if this was put in place for a reason. Will take a closer look |
One helper builds every SDK request and hardcodes Accept: application/json. That is right for the control plane, where the orchestrator is a JSON API, but call_runner is the one function whose destination is arbitrary app code. An upstream that content negotiates then answers in JSON because the SDK asked: the api-proxy example advertises raw JPEG bytes and Hugging Face returned a base64 PNG in a JSON string, so the client wrote base64 text to a .jpg. App calls now state no preference and let the app pick. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
88cdbb8 to
a7054f7
Compare
Stacked on #51 (base
rs/call-runner-raw-bytes), which handles the response side. Without this, its non-JSON branch is unreachable for the apps it targets._json_request_partshardcodesAccept: application/jsonon every SDK request. Right for the control plane, butcall_runnertalks to arbitrary app code, so it asserts a preference the caller never made, and an upstream that content-negotiates obliges. From the api-proxy example, which advertises raw JPEG bytes:The client wrote 1.9 MB of base64 text to a
.jpg.App calls now send
Accept: */*and let the app, or the upstream it fronts, pick. Control plane untouched,http.pyunchanged.*/*rather than omitting the header: aiohttp sends it anyway, so this only makes the choice visible.JSON apps are unaffected, since
json_responsesets its own content type and the buffered path branches on the response. Noheadersargument for now: no caller needs to negotiate, and it can be added later without breaking anyone.Verified against api-proxy: a real Hugging Face call now returns a 1024x1024
image/jpeg. Suite passes (16).