Repository navigation
fix(azure_ai): raise BadRequestError for invalid FLUX 2 image edit input - #52547
Open
shadowmodder wants to merge 2 commits into
Open
shadowmodder wants to merge 2 commits into
shadowmodder wants to merge 2 commits into
Conversation
Signed-off-by: shadowmodder <sudhirvissa@gmail.com>
Signed-off-by: shadowmodder <sudhirvissa@gmail.com>
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
[insert handwritten description here]
Details
TLDR
Problem this solves:
How it solves it:
Intentional product change: invalid FLUX 2 image edit requests now fail with HTTP 400 instead of HTTP 500.
User Flow
Before: a caller sends a FLUX 2 image edit with a missing prompt or image and gets a retryable server error
After: the same request fails fast as a client error
Relevant issues
Fixes #52533
Pre-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 moreScreenshots / Proof of Fix
E2E exception at 8054276f. The full diff is four exception raises in one request transformation plus tests, and the contract is the exception type and status code the transformation raises, which the checks below prove directly. No Azure AI API key is available in my sandbox, so no live provider call was run.
Reproduction script (calls transform_image_edit_request with four invalid inputs: missing prompt, missing image, empty image list, too many reference images):
Tests:
One scope note: _convert_image_to_base64 in the same file also raises ValueError for an unsupported image type. The issue does not name that check, so this PR leaves it unchanged.
Type
Bug Fix
Final Attestation