Repository navigation
fix(azure_ai): translate size param to width/height for flux.2-pro image edits #36645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,15 +26,14 @@ class AzureFoundryFlux2ImageEditConfig(OpenAIImageEditConfig): | |
| """ | ||
|
|
||
| def get_supported_openai_params(self, model: str) -> list: | ||
| """ | ||
| FLUX 2 supports a subset of OpenAI image edit params | ||
| """ | ||
| return [ | ||
| "prompt", | ||
| "image", | ||
| "model", | ||
| "n", | ||
| "size", | ||
| "width", | ||
| "height", | ||
| ] | ||
|
|
||
| def map_openai_params( | ||
|
|
@@ -43,15 +42,17 @@ def map_openai_params( | |
| model: str, | ||
| drop_params: bool, | ||
| ) -> dict: | ||
| """ | ||
| Map OpenAI params to FLUX 2 params. | ||
| FLUX 2 uses the same param names as OpenAI for supported params. | ||
| """ | ||
| mapped_params: Final[dict[str, Any]] = {} | ||
| supported_params: Final = self.get_supported_openai_params(model) | ||
|
|
||
| for key, value in dict(image_edit_optional_params).items(): | ||
| if key in supported_params and value is not None: | ||
| if key not in supported_params or value is None: | ||
| continue | ||
| if key == "size" and isinstance(value, str) and "x" in value: | ||
| w, h = value.lower().split("x", 1) | ||
| mapped_params["width"] = int(w) | ||
| mapped_params["height"] = int(h) | ||
|
Comment on lines
+53
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new assignments incrementally mutate the 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! |
||
| elif key != "size": | ||
| mapped_params[key] = value | ||
|
|
||
| return mapped_params | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When callers pass the newly supported
widthandheightparameters through the publicimage_editAPI, the shared request filter removes them becauseImageEditOptionalRequestParamsdoes not define those keys, causing the provider request to omit the requested dimensions and use its default size.Knowledge Base Used: LLM Provider Adapters