mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(azure_ai): validate MAI edit size by consuming map iterator
Greptile: lazy map() never evaluated int() so values like 1024xabc passed through. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e30ad6be87
commit
93c1ca7bf5
2 changed files with 10 additions and 1 deletions
|
|
@ -73,7 +73,7 @@ class AzureFoundryMAIImageEditConfig(OpenAIImageEditConfig):
|
|||
|
||||
if "x" in size:
|
||||
try:
|
||||
map(int, size.lower().split("x"))
|
||||
tuple(map(int, size.lower().split("x", 1)))
|
||||
return
|
||||
except ValueError:
|
||||
raise ValueError(
|
||||
|
|
|
|||
|
|
@ -80,6 +80,15 @@ class TestAzureMAIImageEdit:
|
|||
drop_params=True,
|
||||
)
|
||||
|
||||
def test_map_openai_params_invalid_size_format_raises(self):
|
||||
config = AzureFoundryMAIImageEditConfig()
|
||||
with pytest.raises(ValueError, match="Invalid size format: '1024xabc'"):
|
||||
config.map_openai_params(
|
||||
image_edit_optional_params={"size": "1024xabc"},
|
||||
model="MAI-Image-2.5",
|
||||
drop_params=True,
|
||||
)
|
||||
|
||||
def test_transform_image_edit_request_uses_image_field(self):
|
||||
config = AzureFoundryMAIImageEditConfig()
|
||||
image_bytes = io.BytesIO(b"fake-image-bytes")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue