Repository navigation
fix(azure_ai): translate size param to width/height for flux.2-pro image edits - #36645
guptaishaan wants to merge 1 commit into
Conversation
…age edits ## TLDR Signed-off-by: Ishaan <ishaangupta0408@gmail.com>
|
|
Greptile SummaryThe PR translates Azure FLUX 2 image-edit
Confidence Score: 4/5The size translation itself is sound, but direct width and height support does not work through the public API and should be fixed before merging. The shared image-edit filter removes width and height before the Azure FLUX 2 mapper runs, so one of the newly claimed supported input paths silently falls back to provider defaults; the new branch also conflicts with the repository's immutability convention. Files Needing Attention: litellm/llms/azure_ai/image_edit/flux2_transformation.py, litellm/types/images/main.py, litellm/images/utils.py
|
| Filename | Overview |
|---|---|
| litellm/llms/azure_ai/image_edit/flux2_transformation.py | Correctly translates size locally, but newly advertised direct width and height parameters are removed upstream and the implementation violates the repository's immutability convention. |
| tests/test_litellm/llms/azure_ai/image_edit/test_azure_ai_image_edit_transformation.py | Adds useful mapper-level happy-path coverage, but the direct-dimension test bypasses the public filtering stage that makes those parameters unreachable in actual image-edit calls. |
Reviews (1): Last reviewed commit: "fix(azure_ai): translate size param to w..." | Re-trigger Greptile
| "width", | ||
| "height", |
There was a problem hiding this comment.
Direct dimensions are filtered out
When callers pass the newly supported width and height parameters through the public image_edit API, the shared request filter removes them because ImageEditOptionalRequestParams does not define those keys, causing the provider request to omit the requested dimensions and use its default size.
Knowledge Base Used: LLM Provider Adapters
| mapped_params["width"] = int(w) | ||
| mapped_params["height"] = int(h) |
There was a problem hiding this comment.
Dimension mapping mutates final state
The new assignments incrementally mutate the Final dictionary, contrary to the repository's immutability convention and making the mapping logic dependent on mutation order; construct the mapped dimensions without mutating local state.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Superseded by #39424, which merged with the same size to width and height mapping for FLUX.2 image edits plus flex routing |
TLDR
Problem this solves:
AzureFoundryFlux2ImageEditConfig.map_openai_paramswas passingsizeverbatim into the request body, but the Azure AI Foundry FLUX 2 endpoint (backed by BFL's API) does not accept asizekey. It only acceptswidthandheightas separate integers. As a result, everyimages.editcall through this config produced a 1024x1024 image regardless of whatsizewas passed.How it solves it:
In
map_openai_params, when thesizekey is encountered it is now split on"x"and emitted aswidth/heightintegers instead. Directwidth/heightparams are also accepted and forwarded unchanged. Both keys are added toget_supported_openai_paramsso they are not dropped earlier in the pipeline.User Flow
Call
litellm.image_edit(model="azure_ai/flux.2-pro", ..., size="896x1184")and receive an image at 896x1184 instead of the default 1024x1024.Relevant issues
Fixes #36644
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Run
python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml --detailed_debugand:The returned image should be 896x1184 instead of 1024x1024.
Type
🐛 Bug Fix
Caveats (if any)
If
sizeis passed in a non-WxHformat, it is silently dropped (not forwarded). This matches the behavior of the MAI config's_map_size_param.