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 50MB. 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 50MB. 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 path)
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 50MB. 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.
-
inputFidelity
final ImageEditParams.Builder inputFidelity(ImageEditParams.InputFidelity inputFidelity)
Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for
gpt-image-1
. Supportshigh
andlow
. Defaults tolow
.
-
inputFidelity
final ImageEditParams.Builder inputFidelity(Optional<ImageEditParams.InputFidelity> inputFidelity)
Alias for calling Builder.inputFidelity with
inputFidelity.orElse(null)
.
-
inputFidelity
final ImageEditParams.Builder inputFidelity(MultipartField<ImageEditParams.InputFidelity> inputFidelity)
Sets Builder.inputFidelity to an arbitrary multipart value.
You should usually call Builder.inputFidelity with a well-typed InputFidelity 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 path)
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.
-
outputCompression
final ImageEditParams.Builder outputCompression(Long outputCompression)
The compression level (0-100%) for the generated images. This parameter is only supported for
gpt-image-1
with thewebp
orjpeg
output formats, and defaults to 100.
-
outputCompression
final ImageEditParams.Builder outputCompression(Long outputCompression)
Alias for Builder.outputCompression.
This unboxed primitive overload exists for backwards compatibility.
-
outputCompression
final ImageEditParams.Builder outputCompression(Optional<Long> outputCompression)
Alias for calling Builder.outputCompression with
outputCompression.orElse(null)
.
-
outputCompression
final ImageEditParams.Builder outputCompression(MultipartField<Long> outputCompression)
Sets Builder.outputCompression to an arbitrary multipart value.
You should usually call Builder.outputCompression with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
outputFormat
final ImageEditParams.Builder outputFormat(ImageEditParams.OutputFormat outputFormat)
The format in which the generated images are returned. This parameter is only supported for
gpt-image-1
. Must be one ofpng
,jpeg
, orwebp
. The default value ispng
.
-
outputFormat
final ImageEditParams.Builder outputFormat(Optional<ImageEditParams.OutputFormat> outputFormat)
Alias for calling Builder.outputFormat with
outputFormat.orElse(null)
.
-
outputFormat
final ImageEditParams.Builder outputFormat(MultipartField<ImageEditParams.OutputFormat> outputFormat)
Sets Builder.outputFormat to an arbitrary multipart value.
You should usually call Builder.outputFormat with a well-typed OutputFormat value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
partialImages
final ImageEditParams.Builder partialImages(Long partialImages)
The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to 0, the response will be a single image sent in one streaming event.
Note that the final image may be sent before the full number of partial images are generated if the full image is generated more quickly.
-
partialImages
final ImageEditParams.Builder partialImages(Long partialImages)
Alias for Builder.partialImages.
This unboxed primitive overload exists for backwards compatibility.
-
partialImages
final ImageEditParams.Builder partialImages(Optional<Long> partialImages)
Alias for calling Builder.partialImages with
partialImages.orElse(null)
.
-
partialImages
final ImageEditParams.Builder partialImages(MultipartField<Long> partialImages)
Sets Builder.partialImages to an arbitrary multipart value.
You should usually call Builder.partialImages 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.
-
additionalBodyProperties
final ImageEditParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final ImageEditParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final ImageEditParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final ImageEditParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final ImageEditParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
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()
-
-
-
-