com.github.tjake.jlama.net.openai.model.CreateImageRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jlama-net Show documentation
Show all versions of jlama-net Show documentation
Jlama: A modern LLM inference engine for Java
/*
* OpenAI API
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.github.tjake.jlama.net.openai.model;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.tjake.jlama.net.openai.model.CreateImageRequestModel;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
import org.hibernate.validator.constraints.*;
import com.github.tjake.jlama.net.openai.JSON;
/**
* CreateImageRequest
*/
@JsonPropertyOrder({
CreateImageRequest.JSON_PROPERTY_PROMPT,
CreateImageRequest.JSON_PROPERTY_MODEL,
CreateImageRequest.JSON_PROPERTY_N,
CreateImageRequest.JSON_PROPERTY_QUALITY,
CreateImageRequest.JSON_PROPERTY_RESPONSE_FORMAT,
CreateImageRequest.JSON_PROPERTY_SIZE,
CreateImageRequest.JSON_PROPERTY_STYLE,
CreateImageRequest.JSON_PROPERTY_USER
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateImageRequest {
public static final String JSON_PROPERTY_PROMPT = "prompt";
private String prompt;
public static final String JSON_PROPERTY_MODEL = "model";
private CreateImageRequestModel model;
public static final String JSON_PROPERTY_N = "n";
private Integer n = 1;
/**
* The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`.
*/
public enum QualityEnum {
STANDARD("standard"),
HD("hd");
private String value;
QualityEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static QualityEnum fromValue(String value) {
for (QualityEnum b : QualityEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_QUALITY = "quality";
private QualityEnum quality = QualityEnum.STANDARD;
/**
* The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
*/
public enum ResponseFormatEnum {
URL("url"),
B64_JSON("b64_json");
private String value;
ResponseFormatEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ResponseFormatEnum fromValue(String value) {
for (ResponseFormatEnum b : ResponseFormatEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}
public static final String JSON_PROPERTY_RESPONSE_FORMAT = "response_format";
private ResponseFormatEnum responseFormat = ResponseFormatEnum.URL;
/**
* The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models.
*/
public enum SizeEnum {
_256X256("256x256"),
_512X512("512x512"),
_1024X1024("1024x1024"),
_1792X1024("1792x1024"),
_1024X1792("1024x1792");
private String value;
SizeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static SizeEnum fromValue(String value) {
for (SizeEnum b : SizeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}
public static final String JSON_PROPERTY_SIZE = "size";
private SizeEnum size = SizeEnum._1024X1024;
/**
* The style of the generated images. Must be one of `vivid` or `natural`. 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. This param is only supported for `dall-e-3`.
*/
public enum StyleEnum {
VIVID("vivid"),
NATURAL("natural");
private String value;
StyleEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StyleEnum fromValue(String value) {
for (StyleEnum b : StyleEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}
public static final String JSON_PROPERTY_STYLE = "style";
private StyleEnum style = StyleEnum.VIVID;
public static final String JSON_PROPERTY_USER = "user";
private String user;
public CreateImageRequest() {
}
public CreateImageRequest prompt(String prompt) {
this.prompt = prompt;
return this;
}
/**
* A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.
* @return prompt
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_PROMPT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getPrompt() {
return prompt;
}
@JsonProperty(JSON_PROPERTY_PROMPT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPrompt(String prompt) {
this.prompt = prompt;
}
public CreateImageRequest model(CreateImageRequestModel model) {
this.model = model;
return this;
}
/**
* Get model
* @return model
*/
@jakarta.annotation.Nullable
@Valid
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public CreateImageRequestModel getModel() {
return model;
}
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setModel(CreateImageRequestModel model) {
this.model = model;
}
public CreateImageRequest n(Integer n) {
this.n = n;
return this;
}
/**
* The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported.
* minimum: 1
* maximum: 10
* @return n
*/
@jakarta.annotation.Nullable
@Min(1) @Max(10)
@JsonProperty(JSON_PROPERTY_N)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getN() {
return n;
}
@JsonProperty(JSON_PROPERTY_N)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setN(Integer n) {
this.n = n;
}
public CreateImageRequest quality(QualityEnum quality) {
this.quality = quality;
return this;
}
/**
* The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`.
* @return quality
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_QUALITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public QualityEnum getQuality() {
return quality;
}
@JsonProperty(JSON_PROPERTY_QUALITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setQuality(QualityEnum quality) {
this.quality = quality;
}
public CreateImageRequest responseFormat(ResponseFormatEnum responseFormat) {
this.responseFormat = responseFormat;
return this;
}
/**
* The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
* @return responseFormat
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_RESPONSE_FORMAT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ResponseFormatEnum getResponseFormat() {
return responseFormat;
}
@JsonProperty(JSON_PROPERTY_RESPONSE_FORMAT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setResponseFormat(ResponseFormatEnum responseFormat) {
this.responseFormat = responseFormat;
}
public CreateImageRequest size(SizeEnum size) {
this.size = size;
return this;
}
/**
* The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models.
* @return size
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SIZE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public SizeEnum getSize() {
return size;
}
@JsonProperty(JSON_PROPERTY_SIZE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSize(SizeEnum size) {
this.size = size;
}
public CreateImageRequest style(StyleEnum style) {
this.style = style;
return this;
}
/**
* The style of the generated images. Must be one of `vivid` or `natural`. 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. This param is only supported for `dall-e-3`.
* @return style
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_STYLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public StyleEnum getStyle() {
return style;
}
@JsonProperty(JSON_PROPERTY_STYLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setStyle(StyleEnum style) {
this.style = style;
}
public CreateImageRequest user(String user) {
this.user = user;
return this;
}
/**
* A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
* @return user
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_USER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getUser() {
return user;
}
@JsonProperty(JSON_PROPERTY_USER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUser(String user) {
this.user = user;
}
/**
* Return true if this CreateImageRequest object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateImageRequest createImageRequest = (CreateImageRequest) o;
return Objects.equals(this.prompt, createImageRequest.prompt) &&
Objects.equals(this.model, createImageRequest.model) &&
Objects.equals(this.n, createImageRequest.n) &&
Objects.equals(this.quality, createImageRequest.quality) &&
Objects.equals(this.responseFormat, createImageRequest.responseFormat) &&
Objects.equals(this.size, createImageRequest.size) &&
Objects.equals(this.style, createImageRequest.style) &&
Objects.equals(this.user, createImageRequest.user);
}
@Override
public int hashCode() {
return Objects.hash(prompt, model, n, quality, responseFormat, size, style, user);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateImageRequest {\n");
sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n");
sb.append(" model: ").append(toIndentedString(model)).append("\n");
sb.append(" n: ").append(toIndentedString(n)).append("\n");
sb.append(" quality: ").append(toIndentedString(quality)).append("\n");
sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n");
sb.append(" size: ").append(toIndentedString(size)).append("\n");
sb.append(" style: ").append(toIndentedString(style)).append("\n");
sb.append(" user: ").append(toIndentedString(user)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}