com.github.tjake.jlama.net.openai.model.CreateEmbeddingRequest Maven / Gradle / Ivy
/*
* 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.CreateEmbeddingRequestInput;
import com.github.tjake.jlama.net.openai.model.CreateEmbeddingRequestModel;
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;
/**
* CreateEmbeddingRequest
*/
@JsonPropertyOrder({
CreateEmbeddingRequest.JSON_PROPERTY_INPUT,
CreateEmbeddingRequest.JSON_PROPERTY_MODEL,
CreateEmbeddingRequest.JSON_PROPERTY_ENCODING_FORMAT,
CreateEmbeddingRequest.JSON_PROPERTY_DIMENSIONS,
CreateEmbeddingRequest.JSON_PROPERTY_USER
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateEmbeddingRequest {
public static final String JSON_PROPERTY_INPUT = "input";
private CreateEmbeddingRequestInput input;
public static final String JSON_PROPERTY_MODEL = "model";
private CreateEmbeddingRequestModel model;
/**
* The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
*/
public enum EncodingFormatEnum {
FLOAT("float"),
BASE64("base64");
private String value;
EncodingFormatEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static EncodingFormatEnum fromValue(String value) {
for (EncodingFormatEnum b : EncodingFormatEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_ENCODING_FORMAT = "encoding_format";
private EncodingFormatEnum encodingFormat = EncodingFormatEnum.FLOAT;
public static final String JSON_PROPERTY_DIMENSIONS = "dimensions";
private Integer dimensions;
public static final String JSON_PROPERTY_USER = "user";
private String user;
public CreateEmbeddingRequest() {
}
public CreateEmbeddingRequest input(CreateEmbeddingRequestInput input) {
this.input = input;
return this;
}
/**
* Get input
* @return input
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_INPUT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public CreateEmbeddingRequestInput getInput() {
return input;
}
@JsonProperty(JSON_PROPERTY_INPUT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setInput(CreateEmbeddingRequestInput input) {
this.input = input;
}
public CreateEmbeddingRequest model(CreateEmbeddingRequestModel model) {
this.model = model;
return this;
}
/**
* Get model
* @return model
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public CreateEmbeddingRequestModel getModel() {
return model;
}
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setModel(CreateEmbeddingRequestModel model) {
this.model = model;
}
public CreateEmbeddingRequest encodingFormat(EncodingFormatEnum encodingFormat) {
this.encodingFormat = encodingFormat;
return this;
}
/**
* The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
* @return encodingFormat
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ENCODING_FORMAT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public EncodingFormatEnum getEncodingFormat() {
return encodingFormat;
}
@JsonProperty(JSON_PROPERTY_ENCODING_FORMAT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEncodingFormat(EncodingFormatEnum encodingFormat) {
this.encodingFormat = encodingFormat;
}
public CreateEmbeddingRequest dimensions(Integer dimensions) {
this.dimensions = dimensions;
return this;
}
/**
* The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
* minimum: 1
* @return dimensions
*/
@jakarta.annotation.Nullable
@Min(1)
@JsonProperty(JSON_PROPERTY_DIMENSIONS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getDimensions() {
return dimensions;
}
@JsonProperty(JSON_PROPERTY_DIMENSIONS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDimensions(Integer dimensions) {
this.dimensions = dimensions;
}
public CreateEmbeddingRequest 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 CreateEmbeddingRequest object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateEmbeddingRequest createEmbeddingRequest = (CreateEmbeddingRequest) o;
return Objects.equals(this.input, createEmbeddingRequest.input) &&
Objects.equals(this.model, createEmbeddingRequest.model) &&
Objects.equals(this.encodingFormat, createEmbeddingRequest.encodingFormat) &&
Objects.equals(this.dimensions, createEmbeddingRequest.dimensions) &&
Objects.equals(this.user, createEmbeddingRequest.user);
}
@Override
public int hashCode() {
return Objects.hash(input, model, encodingFormat, dimensions, user);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateEmbeddingRequest {\n");
sb.append(" input: ").append(toIndentedString(input)).append("\n");
sb.append(" model: ").append(toIndentedString(model)).append("\n");
sb.append(" encodingFormat: ").append(toIndentedString(encodingFormat)).append("\n");
sb.append(" dimensions: ").append(toIndentedString(dimensions)).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 ");
}
}