feat: add reference_image support for lucy-pro-i2i#43
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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"): |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 2addaa9. Configure here.


Summary
The
lucy-pro-i2imodel 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
Note
Low Risk
Low risk: adds an optional additional form-data file field for the image
processpath, with a focused unit test covering the new parameter.Overview
Adds optional
reference_imagesupport to thelucy-pro-i2iimage-to-imageprocessAPI.Updates the
ImageToImageInputschema to acceptreference_imageand ensures request building treats it as multipart file content, plus adds a unit test that exercisesprocess()with bothdataandreference_image.Reviewed by Cursor Bugbot for commit 2addaa9. Bugbot is set up for automated code reviews on this repo. Configure here.