com.github.tjake.jlama.net.openai.model.CreateEmbeddingResponse 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.CreateEmbeddingResponseUsage;
import com.github.tjake.jlama.net.openai.model.Embedding;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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;
/**
* CreateEmbeddingResponse
*/
@JsonPropertyOrder({
CreateEmbeddingResponse.JSON_PROPERTY_DATA,
CreateEmbeddingResponse.JSON_PROPERTY_MODEL,
CreateEmbeddingResponse.JSON_PROPERTY_OBJECT,
CreateEmbeddingResponse.JSON_PROPERTY_USAGE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateEmbeddingResponse {
public static final String JSON_PROPERTY_DATA = "data";
private List<@Valid Embedding> data;
public static final String JSON_PROPERTY_MODEL = "model";
private String model;
/**
* The object type, which is always \"list\".
*/
public enum ObjectEnum {
LIST("list");
private String value;
ObjectEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ObjectEnum fromValue(String value) {
for (ObjectEnum b : ObjectEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_OBJECT = "object";
private ObjectEnum _object;
public static final String JSON_PROPERTY_USAGE = "usage";
private CreateEmbeddingResponseUsage usage;
public CreateEmbeddingResponse() {
}
public CreateEmbeddingResponse data(List<@Valid Embedding> data) {
this.data = data;
return this;
}
public CreateEmbeddingResponse addDataItem(Embedding dataItem) {
if (this.data == null) {
this.data = new ArrayList<>();
}
this.data.add(dataItem);
return this;
}
/**
* The list of embeddings generated by the model.
* @return data
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_DATA)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<@Valid Embedding> getData() {
return data;
}
@JsonProperty(JSON_PROPERTY_DATA)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setData(List<@Valid Embedding> data) {
this.data = data;
}
public CreateEmbeddingResponse model(String model) {
this.model = model;
return this;
}
/**
* The name of the model used to generate the embedding.
* @return model
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getModel() {
return model;
}
@JsonProperty(JSON_PROPERTY_MODEL)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setModel(String model) {
this.model = model;
}
public CreateEmbeddingResponse _object(ObjectEnum _object) {
this._object = _object;
return this;
}
/**
* The object type, which is always \"list\".
* @return _object
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_OBJECT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public ObjectEnum getObject() {
return _object;
}
@JsonProperty(JSON_PROPERTY_OBJECT)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setObject(ObjectEnum _object) {
this._object = _object;
}
public CreateEmbeddingResponse usage(CreateEmbeddingResponseUsage usage) {
this.usage = usage;
return this;
}
/**
* Get usage
* @return usage
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_USAGE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public CreateEmbeddingResponseUsage getUsage() {
return usage;
}
@JsonProperty(JSON_PROPERTY_USAGE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setUsage(CreateEmbeddingResponseUsage usage) {
this.usage = usage;
}
/**
* Return true if this CreateEmbeddingResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateEmbeddingResponse createEmbeddingResponse = (CreateEmbeddingResponse) o;
return Objects.equals(this.data, createEmbeddingResponse.data) &&
Objects.equals(this.model, createEmbeddingResponse.model) &&
Objects.equals(this._object, createEmbeddingResponse._object) &&
Objects.equals(this.usage, createEmbeddingResponse.usage);
}
@Override
public int hashCode() {
return Objects.hash(data, model, _object, usage);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateEmbeddingResponse {\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
sb.append(" model: ").append(toIndentedString(model)).append("\n");
sb.append(" _object: ").append(toIndentedString(_object)).append("\n");
sb.append(" usage: ").append(toIndentedString(usage)).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 ");
}
}