Class ImageGenerateParams.Builder
-
- All Implemented Interfaces:
public final class ImageGenerateParams.Builder
A builder for ImageGenerateParams.
-
-
Method Summary
-
-
Method Detail
-
body
final ImageGenerateParams.Builder body(ImageGenerateParams.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:
-
prompt
final ImageGenerateParams.Builder prompt(String prompt)
A text description of the desired image(s). The maximum length is 32000 characters for
gpt-image-1
, 1000 characters fordall-e-2
and 4000 characters fordall-e-3
.
-
prompt
final ImageGenerateParams.Builder prompt(JsonField<String> prompt)
Sets Builder.prompt to an arbitrary JSON 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 ImageGenerateParams.Builder background(ImageGenerateParams.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 ImageGenerateParams.Builder background(Optional<ImageGenerateParams.Background> background)
Alias for calling Builder.background with
background.orElse(null)
.
-
background
final ImageGenerateParams.Builder background(JsonField<ImageGenerateParams.Background> background)
Sets Builder.background to an arbitrary JSON 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.
-
model
final ImageGenerateParams.Builder model(ImageModel model)
The model to use for image generation. One of
dall-e-2
,dall-e-3
, orgpt-image-1
. Defaults todall-e-2
unless a parameter specific togpt-image-1
is used.
-
model
final ImageGenerateParams.Builder model(Optional<ImageModel> model)
Alias for calling Builder.model with
model.orElse(null)
.
-
model
final ImageGenerateParams.Builder model(JsonField<ImageModel> model)
Sets Builder.model to an arbitrary JSON 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 ImageGenerateParams.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.
-
moderation
final ImageGenerateParams.Builder moderation(ImageGenerateParams.Moderation moderation)
Control the content-moderation level for images generated by
gpt-image-1
. Must be eitherlow
for less restrictive filtering orauto
(default value).
-
moderation
final ImageGenerateParams.Builder moderation(Optional<ImageGenerateParams.Moderation> moderation)
Alias for calling Builder.moderation with
moderation.orElse(null)
.
-
moderation
final ImageGenerateParams.Builder moderation(JsonField<ImageGenerateParams.Moderation> moderation)
Sets Builder.moderation to an arbitrary JSON value.
You should usually call Builder.moderation with a well-typed Moderation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
n
final ImageGenerateParams.Builder n(Long n)
The number of images to generate. Must be between 1 and 10. For
dall-e-3
, onlyn=1
is supported.
-
n
final ImageGenerateParams.Builder n(Long n)
Alias for Builder.n.
This unboxed primitive overload exists for backwards compatibility.
-
n
final ImageGenerateParams.Builder n(Optional<Long> n)
Alias for calling Builder.n with
n.orElse(null)
.
-
n
final ImageGenerateParams.Builder n(JsonField<Long> n)
Sets Builder.n to an arbitrary JSON 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 ImageGenerateParams.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 ImageGenerateParams.Builder outputCompression(Long outputCompression)
Alias for Builder.outputCompression.
This unboxed primitive overload exists for backwards compatibility.
-
outputCompression
final ImageGenerateParams.Builder outputCompression(Optional<Long> outputCompression)
Alias for calling Builder.outputCompression with
outputCompression.orElse(null)
.
-
outputCompression
final ImageGenerateParams.Builder outputCompression(JsonField<Long> outputCompression)
Sets Builder.outputCompression to an arbitrary JSON 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 ImageGenerateParams.Builder outputFormat(ImageGenerateParams.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
.
-
outputFormat
final ImageGenerateParams.Builder outputFormat(Optional<ImageGenerateParams.OutputFormat> outputFormat)
Alias for calling Builder.outputFormat with
outputFormat.orElse(null)
.
-
outputFormat
final ImageGenerateParams.Builder outputFormat(JsonField<ImageGenerateParams.OutputFormat> outputFormat)
Sets Builder.outputFormat to an arbitrary JSON 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.
-
quality
final ImageGenerateParams.Builder quality(ImageGenerateParams.Quality quality)
The quality of the image that will be generated.
auto
(default value) will automatically select the best quality for the given model.high
,medium
andlow
are supported forgpt-image-1
.hd
andstandard
are supported fordall-e-3
.standard
is the only option fordall-e-2
.
-
quality
final ImageGenerateParams.Builder quality(Optional<ImageGenerateParams.Quality> quality)
Alias for calling Builder.quality with
quality.orElse(null)
.
-
quality
final ImageGenerateParams.Builder quality(JsonField<ImageGenerateParams.Quality> quality)
Sets Builder.quality to an arbitrary JSON 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 ImageGenerateParams.Builder responseFormat(ImageGenerateParams.ResponseFormat responseFormat)
The format in which generated images with
dall-e-2
anddall-e-3
are returned. Must be one ofurl
orb64_json
. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported forgpt-image-1
which will always return base64-encoded images.
-
responseFormat
final ImageGenerateParams.Builder responseFormat(Optional<ImageGenerateParams.ResponseFormat> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null)
.
-
responseFormat
final ImageGenerateParams.Builder responseFormat(JsonField<ImageGenerateParams.ResponseFormat> responseFormat)
Sets Builder.responseFormat to an arbitrary JSON 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 ImageGenerateParams.Builder size(ImageGenerateParams.Size size)
The size of the generated images. Must be one of
1024x1024
,1536x1024
(landscape),1024x1536
(portrait), orauto
(default value) forgpt-image-1
, one of256x256
,512x512
, or1024x1024
fordall-e-2
, and one of1024x1024
,1792x1024
, or1024x1792
fordall-e-3
.
-
size
final ImageGenerateParams.Builder size(Optional<ImageGenerateParams.Size> size)
Alias for calling Builder.size with
size.orElse(null)
.
-
size
final ImageGenerateParams.Builder size(JsonField<ImageGenerateParams.Size> size)
Sets Builder.size to an arbitrary JSON 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.
-
style
final ImageGenerateParams.Builder style(ImageGenerateParams.Style style)
The style of the generated images. This parameter is only supported for
dall-e-3
. Must be one ofvivid
ornatural
. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
-
style
final ImageGenerateParams.Builder style(Optional<ImageGenerateParams.Style> style)
Alias for calling Builder.style with
style.orElse(null)
.
-
style
final ImageGenerateParams.Builder style(JsonField<ImageGenerateParams.Style> style)
Sets Builder.style to an arbitrary JSON value.
You should usually call Builder.style with a well-typed Style value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
user
final ImageGenerateParams.Builder user(String user)
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
user
final ImageGenerateParams.Builder user(JsonField<String> user)
Sets Builder.user to an arbitrary JSON 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 ImageGenerateParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final ImageGenerateParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final ImageGenerateParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final ImageGenerateParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final ImageGenerateParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
additionalHeaders
final ImageGenerateParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final ImageGenerateParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final ImageGenerateParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final ImageGenerateParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final ImageGenerateParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final ImageGenerateParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final ImageGenerateParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final ImageGenerateParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final ImageGenerateParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final ImageGenerateParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final ImageGenerateParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final ImageGenerateParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final ImageGenerateParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final ImageGenerateParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final ImageGenerateParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final ImageGenerateParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final ImageGenerateParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final ImageGenerateParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final ImageGenerateParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final ImageGenerateParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final ImageGenerateParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final ImageGenerateParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final ImageGenerateParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final ImageGenerateParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final ImageGenerateParams build()
Returns an immutable instance of ImageGenerateParams.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.prompt()
-
-
-
-