Repository navigation
fix(workers-ai): pass source image and mask to executeQuery in the correct order - #6373
Open
Lubaoshuai wants to merge 2 commits into
Open
Lubaoshuai wants to merge 2 commits into
Lubaoshuai wants to merge 2 commits into
Conversation
…rrect order The edit(Image, String) overload sent the source image in the mask field (and image as null), and edit(Image, Image, String) swapped the two. Both now map to executeQuery(prompt, image, mask) as declared. Adds WorkersAiImageModelTest with a mocked HTTP client covering edit, edit-with-mask and generate request payloads. Fixes langchain4j#6149
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #6149
Change
WorkersAiImageModelbuilds its request throughexecuteQuery(String prompt, Image image, Image mask), but bothedit()overloads passed the arguments in the opposite order:edit(image, prompt)calledexecuteQuery(prompt, null, image)— the source pixels were sent in themaskfield andimagewasnull, so the image to edit was never sent as the image.edit(image, mask, prompt)calledexecuteQuery(prompt, mask, image)— the two fields were exchanged.Both overloads now call
executeQuery(prompt, image, mask)as declared. Thegenerate()overloads are unaffected (they passnull, null).Test
Added
WorkersAiImageModelTestusingMockHttpClient(requires thelangchain4j-http-clienttest-jar in the module):edit(image, prompt)serializes the source pixels under"image"and leaves"mask"nulledit(image, mask, prompt)serializes the source and mask pixels under the correct, distinct fieldsgenerate(prompt)leaves both null (regression)mvn -pl langchain4j-workers-ai test: 77 tests, 0 failures.