Skip to content

feat: add reference_image support for lucy-pro-i2i#43

Merged
AdirAmsalem merged 1 commit intomainfrom
add-reference-image-i2i
Apr 5, 2026
Merged

feat: add reference_image support for lucy-pro-i2i#43
AdirAmsalem merged 1 commit intomainfrom
add-reference-image-i2i

Conversation

@AdirAmsalem
Copy link
Copy Markdown
Contributor

@AdirAmsalem AdirAmsalem commented Apr 5, 2026

Summary

The lucy-pro-i2i model now supports an optional reference image to guide edits — for example, providing a photo of a hat to add to a person in the base image. This matches the same capability already available in the TS SDK.

Tested end-to-end against production with and without reference image — both paths work correctly.

Usage

result = await client.process({
    "model": models.image("lucy-pro-i2i"),
    "prompt": "Add the object from the reference image",
    "data": "input.png",
    "reference_image": "reference.png",
})

Note

Low Risk
Low risk: adds an optional additional form-data file field for the image process path, with a focused unit test covering the new parameter.

Overview
Adds optional reference_image support to the lucy-pro-i2i image-to-image process API.

Updates the ImageToImageInput schema to accept reference_image and ensures request building treats it as multipart file content, plus adds a unit test that exercises process() with both data and reference_image.

Reviewed by Cursor Bugbot for commit 2addaa9. Bugbot is set up for automated code reviews on this repo. Configure here.

@AdirAmsalem AdirAmsalem merged commit 51047e5 into main Apr 5, 2026
9 checks passed
@AdirAmsalem AdirAmsalem deleted the add-reference-image-i2i branch April 5, 2026 07:52
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2addaa9. Configure here.

for key, value in inputs.items():
if value is not None:
if key in ("data", "start", "end"):
if key in ("data", "start", "end", "reference_image"):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FILE_FIELDS missing reference_image causes inconsistent file handling

Medium Severity

FILE_FIELDS in client.py was not updated to include "reference_image", even though request.py now treats it as a file field. This causes reference_image to bypass the file-field handling path — it goes into non_file_inputs, passes through model_dump(), and is never placed in file_inputs. While this happens to work for bytes and str, it breaks the established pattern where file inputs get placeholder bytes for validation and their original values are preserved separately. For file-like objects (HasRead), model_dump() may not correctly round-trip the value, leading to a runtime failure.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2addaa9. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant