Class ImageEditParams.Builder
-
- All Implemented Interfaces:
public final class ImageEditParams.Builder
A builder for ImageEditParams.
-
-
Method Summary
-
-
Method Detail
-
body
final ImageEditParams.Builder body(ImageEditParams.Body body)
Sets the entire request body.
This is generally only useful if you are already constructing the body separately. Otherwise, it's more convenient to use the top-level setters instead:
-
image
final ImageEditParams.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
, orjpg
file 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 squarepng
file less than 4MB.
-
image
final ImageEditParams.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.Builder image(InputStream inputStream)
Alias for calling image with
Image.ofInputStream(inputStream)
.
-
image
final ImageEditParams.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
, orjpg
file 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 squarepng
file less than 4MB.
-
image
final ImageEditParams.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
, orjpg
file 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 squarepng
file less than 4MB.
-
imageOfInputStreams
final ImageEditParams.Builder imageOfInputStreams(List<InputStream> inputStreams)
Alias for calling image with
Image.ofInputStreams(inputStreams)
.
-
prompt
final ImageEditParams.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.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.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
,opaque
orauto
(default value). Whenauto
is 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.Builder background(Optional<ImageEditParams.Background> background)
Alias for calling Builder.background with
background.orElse(null)
.
-
background
final ImageEditParams.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.Builder mask(InputStream mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
image
should 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.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.Builder mask(ByteArray mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
image
should 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.Builder mask(Path mask)
An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
image
should 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.Builder model(ImageModel model)
The model to use for image generation. Only
dall-e-2
andgpt-image-1
are supported. Defaults todall-e-2
unless a parameter specific togpt-image-1
is used.
-
model
final ImageEditParams.Builder model(Optional<ImageModel> model)
Alias for calling Builder.model with
model.orElse(null)
.
-
model
final ImageEditParams.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.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.Builder n(Long n)
The number of images to generate. Must be between 1 and 10.
-
n
final ImageEditParams.Builder n(Long n)
Alias for Builder.n.
This unboxed primitive overload exists for backwards compatibility.
-
n
final ImageEditParams.Builder n(Optional<Long> n)
Alias for calling Builder.n with
n.orElse(null)
.
-
n
final ImageEditParams.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.Builder quality(ImageEditParams.Quality quality)
The quality of the image that will be generated.
high
,medium
andlow
are only supported forgpt-image-1
.dall-e-2
only supportsstandard
quality. Defaults toauto
.
-
quality
final ImageEditParams.Builder quality(Optional<ImageEditParams.Quality> quality)
Alias for calling Builder.quality with
quality.orElse(null)
.
-
quality
final ImageEditParams.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.Builder responseFormat(ImageEditParams.ResponseFormat responseFormat)
The format in which the generated images are returned. Must be one of
url
orb64_json
. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported fordall-e-2
, asgpt-image-1
will always return base64-encoded images.
-
responseFormat
final ImageEditParams.Builder responseFormat(Optional<ImageEditParams.ResponseFormat> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null)
.
-
responseFormat
final ImageEditParams.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.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
, or1024x1024
fordall-e-2
.
-
size
final ImageEditParams.Builder size(Optional<ImageEditParams.Size> size)
Alias for calling Builder.size with
size.orElse(null)
.
-
size
final ImageEditParams.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.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.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.
-
additionalHeaders
final ImageEditParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final ImageEditParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final ImageEditParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final ImageEditParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final ImageEditParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final ImageEditParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final ImageEditParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final ImageEditParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final ImageEditParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final ImageEditParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final ImageEditParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final ImageEditParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final ImageEditParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final ImageEditParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final ImageEditParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final ImageEditParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final ImageEditParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final ImageEditParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final ImageEditParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final ImageEditParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final ImageEditParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final ImageEditParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final ImageEditParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final ImageEditParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final ImageEditParams build()
Returns an immutable instance of ImageEditParams.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.image() .prompt()
-
-
-
-