mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
fix(bfl): validate empty image list in edit handler
Raise explicit error instead of letting IndexError propagate when an empty image list is passed to image_edit.
This commit is contained in:
parent
835e4c4a75
commit
6fa9a0e52b
1 changed files with 12 additions and 2 deletions
|
|
@ -121,7 +121,12 @@ class BlackForestLabsImageEdit:
|
|||
|
||||
# Transform request
|
||||
# Handle image list vs single image
|
||||
image_input = image[0] if isinstance(image, list) and image else image
|
||||
if isinstance(image, list):
|
||||
if not image:
|
||||
raise BlackForestLabsError(status_code=400, message="No image provided")
|
||||
image_input = image[0]
|
||||
else:
|
||||
image_input = image
|
||||
data, _ = self.config.transform_image_edit_request(
|
||||
model=model,
|
||||
prompt=prompt or "",
|
||||
|
|
@ -219,7 +224,12 @@ class BlackForestLabsImageEdit:
|
|||
)
|
||||
|
||||
# Transform request
|
||||
image_input = image[0] if isinstance(image, list) and image else image
|
||||
if isinstance(image, list):
|
||||
if not image:
|
||||
raise BlackForestLabsError(status_code=400, message="No image provided")
|
||||
image_input = image[0]
|
||||
else:
|
||||
image_input = image
|
||||
data, _ = self.config.transform_image_edit_request(
|
||||
model=model,
|
||||
prompt=prompt or "",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue