Repository navigation
feat(decisions): send images to Cloudflare Clef from /v1/decisions and /v1/systemone - #45762
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
…d /v1/systemone Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Merging this PR will not alter performance
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit be88844. Configure here.
|
Overlaps #45734, which also follows drop_params and inlines remote image URLs. Driving that one and closing this as superseded once it merges |
|
Closing since #45734 merged the same Cloudflare Clef image support for both decisions routes, so this branch is no longer needed |
TLDR
Problem this solves:
/v1/decisionsreturned 400 on anyinput_imagepart/v1/systemonesilently droppedimages, so Clef answered blindHow it solves it:
imageslist (data URLs orcontent_type+base64)input_imageparts on/v1/decisionsare forwarded as Clefimagessupports_image_input, only Cloudflare does todayUser Flow
Before: a developer asking Clef about a screenshot either gets a 400 or a coin-flip answer
input_imagedata URLinput_image content parts are not supported because System One providers accept text input only"images": ["data:image/png;base64,..."]After: both routes reach Clef with the image and the answers reflect what is in it
input_imagepartimagesreturns the same confident answersPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Real proxy, real Cloudflare Workers AI, no mocks. The image is a synthetic 64x64 red square PNG, base64 elided in the commands below. Config
Questions asked are "Is the shape in the image red?" (predicate / noul) and "What shape is shown?" (choice of square or circle)
Before (f57906c)
/v1/decisions with input_image
/v1/systemone with images
After (83db782)
Last updated be88844, later commits only touch tests so this run still holds
/v1/decisions with input_image
/v1/systemone with images
Video
Narrated walkthrough at be88844 covering the Admin UI playground, before and after on both routes, a blue image negative case, the object form, two images and SDK errors, watch here
Mutation check
Each mutation below was applied alone with the fix in place, and the three touched unit files plus
tests/integration/run.py providers tests/integration/translation/decisions/images/test_decisions_images_cloudflare.pywere run, then the mutation was revertedimageskey from the System One wire bodyCloudflareDecisionsConfig.supports_image_input = Falsesystemone_request_to_irdrops images/v1/systemonecase failedinput_imageurls/v1/decisionscase failedType
🆕 New Feature
Caveats (if any)
Low
imagestogether with OpenAIinputin the SDK raises a 400, useinput_imageparts insteadFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/e660dcb9fd6b400b94cc10cb9ca99dd2
Open in Devin Desktop: https://app.devin.ai/desktop/session/e660dcb9fd6b400b94cc10cb9ca99dd2?variant=devin
Note
Medium Risk
Changes request validation and IR-to-provider translation for Decisions; incorrect forwarding could affect multimodal answers, but scope is limited to opt-in providers and is covered by unit/integration tests.
Overview
Adds image support to the Decisions API so Cloudflare Clef (and future opt-in providers) actually receive screenshots instead of ignoring or rejecting them.
System One (
/v1/systemone, SDKstate+images): requests can include animageslist (data URLs or{content_type, base64}), which flows through the IR into the provider wire body when the provider setssupports_image_input(Cloudflare Clef today).OpenAI format (
/v1/decisions,inputwithinput_imageparts):input_imageURLs are collected and forwarded as Clefimagesinstead of returning a blanket “text only” error. Providers withoutsupports_image_inputstill get a clear unsupported response rather than silently dropping images.The public
decisions/adecisionsentrypoints acceptimagesfor System One calls and reject mixing top-levelimageswith OpenAIinput. OpenAI-provider translation can emitinput_imagemessages when System One state carries images.Reviewed by Cursor Bugbot for commit be88844. Bugbot is set up for automated code reviews on this repo. Configure here.