Class ImageEditParams.Body.Builder
-
- All Implemented Interfaces:
public final class ImageEditParams.Body.BuilderA builder for Body.
-
-
Method Summary
Modifier and Type Method Description final ImageEditParams.Body.Builderimage(ImageEditParams.Image image)The image(s) to edit. final ImageEditParams.Body.Builderimage(MultipartField<ImageEditParams.Image> image)Sets Builder.image to an arbitrary multipart value. final ImageEditParams.Body.Builderimage(InputStream inputStream)Alias for calling image with Image.ofInputStream(inputStream).final ImageEditParams.Body.Builderimage(ByteArray inputStream)The image(s) to edit. final ImageEditParams.Body.Builderimage(Path inputStream)The image(s) to edit. final ImageEditParams.Body.BuilderimageOfInputStreams(List<InputStream> inputStreams)Alias for calling image with Image.ofInputStreams(inputStreams).final ImageEditParams.Body.Builderprompt(String prompt)A text description of the desired image(s). final ImageEditParams.Body.Builderprompt(MultipartField<String> prompt)Sets Builder.prompt to an arbitrary multipart value. final ImageEditParams.Body.Builderbackground(ImageEditParams.Background background)Allows to set transparency for the background of the generated image(s). final ImageEditParams.Body.Builderbackground(Optional<ImageEditParams.Background> background)Alias for calling Builder.background with background.orElse(null).final ImageEditParams.Body.Builderbackground(MultipartField<ImageEditParams.Background> background)Sets Builder.background to an arbitrary multipart value. final ImageEditParams.Body.Buildermask(InputStream mask)An additional image whose fully transparent areas (e.g. final ImageEditParams.Body.Buildermask(MultipartField<InputStream> mask)Sets Builder.mask to an arbitrary multipart value. final ImageEditParams.Body.Buildermask(ByteArray mask)An additional image whose fully transparent areas (e.g. final ImageEditParams.Body.Buildermask(Path mask)An additional image whose fully transparent areas (e.g. final ImageEditParams.Body.Buildermodel(ImageModel model)The model to use for image generation. final ImageEditParams.Body.Buildermodel(Optional<ImageModel> model)Alias for calling Builder.model with model.orElse(null).final ImageEditParams.Body.Buildermodel(MultipartField<ImageModel> model)Sets Builder.model to an arbitrary multipart value. final ImageEditParams.Body.Buildermodel(String value)Sets model to an arbitrary String. final ImageEditParams.Body.Buildern(Long n)The number of images to generate. final ImageEditParams.Body.Buildern(Long n)Alias for Builder.n. final ImageEditParams.Body.Buildern(Optional<Long> n)Alias for calling Builder.n with n.orElse(null).final ImageEditParams.Body.Buildern(MultipartField<Long> n)Sets Builder.n to an arbitrary multipart value. final ImageEditParams.Body.Builderquality(ImageEditParams.Quality quality)The quality of the image that will be generated. final ImageEditParams.Body.Builderquality(Optional<ImageEditParams.Quality> quality)Alias for calling Builder.quality with quality.orElse(null).final ImageEditParams.Body.Builderquality(MultipartField<ImageEditParams.Quality> quality)Sets Builder.quality to an arbitrary multipart value. final ImageEditParams.Body.BuilderresponseFormat(ImageEditParams.ResponseFormat responseFormat)The format in which the generated images are returned. final ImageEditParams.Body.BuilderresponseFormat(Optional<ImageEditParams.ResponseFormat> responseFormat)Alias for calling Builder.responseFormat with responseFormat.orElse(null).final ImageEditParams.Body.BuilderresponseFormat(MultipartField<ImageEditParams.ResponseFormat> responseFormat)Sets Builder.responseFormat to an arbitrary multipart value. final ImageEditParams.Body.Buildersize(ImageEditParams.Size size)The size of the generated images. final ImageEditParams.Body.Buildersize(Optional<ImageEditParams.Size> size)Alias for calling Builder.size with size.orElse(null).final ImageEditParams.Body.Buildersize(MultipartField<ImageEditParams.Size> size)Sets Builder.size to an arbitrary multipart value. final ImageEditParams.Body.Builderuser(String user)A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. final ImageEditParams.Body.Builderuser(MultipartField<String> user)Sets Builder.user to an arbitrary multipart value. final ImageEditParams.Bodybuild()Returns an immutable instance of Body. -
-
Method Detail
-
image
final ImageEditParams.Body.Builder image(ImageEditParams.Image image)
The image(s) to edit. Must be a supported image file or an array of images.
For
gpt-image-1, each image should be apng,webp, orjpgfile less than 25MB. You can provide up to 16 images.For
dall-e-2, you can only provide one image, and it should be a squarepngfile less than 4MB.
-
image
final ImageEditParams.Body.Builder image(MultipartField<ImageEditParams.Image> image)
Sets Builder.image to an arbitrary multipart value.
You should usually call Builder.image with a well-typed Image value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
image
final ImageEditParams.Body.Builder image(InputStream inputStream)
Alias for calling image with
Image.ofInputStream(inputStream).
-
image
final ImageEditParams.Body.Builder image(ByteArray inputStream)
The image(s) to edit. Must be a supported image file or an array of images.
For
gpt-image-1, each image should be apng,webp, orjpgfile less than 25MB. You can provide up to 16 images.For
dall-e-2, you can only provide one image, and it should be a squarepngfile less than 4MB.
-
image
final ImageEditParams.Body.Builder image(Path inputStream)
The image(s) to edit. Must be a supported image file or an array of images.
For
gpt-image-1, each image should be apng,webp, orjpgfile less than 25MB. You can provide up to 16 images.For
dall-e-2, you can only provide one image, and it should be a squarepngfile less than 4MB.
-
imageOfInputStreams
final ImageEditParams.Body.Builder imageOfInputStreams(List<InputStream> inputStreams)
Alias for calling image with
Image.ofInputStreams(inputStreams).
-
prompt
final ImageEditParams.Body.Builder prompt(String prompt)
A text description of the desired image(s). The maximum length is 1000 characters for
dall-e-2, and 32000 characters forgpt-image-1.
-
prompt
final ImageEditParams.Body.Builder prompt(MultipartField<String> prompt)
Sets Builder.prompt to an arbitrary multipart value.
You should usually call Builder.prompt with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
background
final ImageEditParams.Body.Builder background(ImageEditParams.Background background)
Allows to set transparency for the background of the generated image(s). This parameter is only supported for
gpt-image-1. Must be one oftransparent,opaqueorauto(default value). Whenautois used, the model will automatically determine the best background for the image.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.
-
background
final ImageEditParams.Body.Builder background(Optional<ImageEditParams.Background> background)
Alias for calling Builder.background with
background.orElse(null).
-
background
final ImageEditParams.Body.Builder background(MultipartField<ImageEditParams.Background> background)
Sets Builder.background to an arbitrary multipart value.
You should usually call Builder.background with a well-typed Background value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
mask
final ImageEditParams.Body.Builder mask(InputStream mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
imageshould be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions asimage.
-
mask
final ImageEditParams.Body.Builder mask(MultipartField<InputStream> mask)
Sets Builder.mask to an arbitrary multipart value.
You should usually call Builder.mask with a well-typed InputStream value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
mask
final ImageEditParams.Body.Builder mask(ByteArray mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
imageshould be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions asimage.
-
mask
final ImageEditParams.Body.Builder mask(Path mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
imageshould be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions asimage.
-
model
final ImageEditParams.Body.Builder model(ImageModel model)
The model to use for image generation. Only
dall-e-2andgpt-image-1are supported. Defaults todall-e-2unless a parameter specific togpt-image-1is used.
-
model
final ImageEditParams.Body.Builder model(Optional<ImageModel> model)
Alias for calling Builder.model with
model.orElse(null).
-
model
final ImageEditParams.Body.Builder model(MultipartField<ImageModel> model)
Sets Builder.model to an arbitrary multipart value.
You should usually call Builder.model with a well-typed ImageModel value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final ImageEditParams.Body.Builder model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed ImageModel constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
n
final ImageEditParams.Body.Builder n(Long n)
The number of images to generate. Must be between 1 and 10.
-
n
final ImageEditParams.Body.Builder n(Long n)
Alias for Builder.n.
This unboxed primitive overload exists for backwards compatibility.
-
n
final ImageEditParams.Body.Builder n(Optional<Long> n)
Alias for calling Builder.n with
n.orElse(null).
-
n
final ImageEditParams.Body.Builder n(MultipartField<Long> n)
Sets Builder.n to an arbitrary multipart value.
You should usually call Builder.n with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
quality
final ImageEditParams.Body.Builder quality(ImageEditParams.Quality quality)
The quality of the image that will be generated.
high,mediumandloware only supported forgpt-image-1.dall-e-2only supportsstandardquality. Defaults toauto.
-
quality
final ImageEditParams.Body.Builder quality(Optional<ImageEditParams.Quality> quality)
Alias for calling Builder.quality with
quality.orElse(null).
-
quality
final ImageEditParams.Body.Builder quality(MultipartField<ImageEditParams.Quality> quality)
Sets Builder.quality to an arbitrary multipart value.
You should usually call Builder.quality with a well-typed Quality value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
responseFormat
final ImageEditParams.Body.Builder responseFormat(ImageEditParams.ResponseFormat responseFormat)
The format in which the generated images are returned. Must be one of
urlorb64_json. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported fordall-e-2, asgpt-image-1will always return base64-encoded images.
-
responseFormat
final ImageEditParams.Body.Builder responseFormat(Optional<ImageEditParams.ResponseFormat> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null).
-
responseFormat
final ImageEditParams.Body.Builder responseFormat(MultipartField<ImageEditParams.ResponseFormat> responseFormat)
Sets Builder.responseFormat to an arbitrary multipart value.
You should usually call Builder.responseFormat with a well-typed ResponseFormat value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
size
final ImageEditParams.Body.Builder size(ImageEditParams.Size size)
The size of the generated images. Must be one of
1024x1024,1536x1024(landscape),1024x1536(portrait), orauto(default value) forgpt-image-1, and one of256x256,512x512, or1024x1024fordall-e-2.
-
size
final ImageEditParams.Body.Builder size(Optional<ImageEditParams.Size> size)
Alias for calling Builder.size with
size.orElse(null).
-
size
final ImageEditParams.Body.Builder size(MultipartField<ImageEditParams.Size> size)
Sets Builder.size to an arbitrary multipart value.
You should usually call Builder.size with a well-typed Size value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
user
final ImageEditParams.Body.Builder user(String user)
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
user
final ImageEditParams.Body.Builder user(MultipartField<String> user)
Sets Builder.user to an arbitrary multipart value.
You should usually call Builder.user with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
build
final ImageEditParams.Body build()
Returns an immutable instance of Body.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.image() .prompt()
-
-
-
-