com.github.tjake.jlama.net.openai.model.CreateCompletionResponse 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.CompletionUsage;
import com.github.tjake.jlama.net.openai.model.CreateCompletionResponseChoicesInner;
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;
/**
* Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).
*/
@JsonPropertyOrder({
CreateCompletionResponse.JSON_PROPERTY_ID,
CreateCompletionResponse.JSON_PROPERTY_CHOICES,
CreateCompletionResponse.JSON_PROPERTY_CREATED,
CreateCompletionResponse.JSON_PROPERTY_MODEL,
CreateCompletionResponse.JSON_PROPERTY_SYSTEM_FINGERPRINT,
CreateCompletionResponse.JSON_PROPERTY_OBJECT,
CreateCompletionResponse.JSON_PROPERTY_USAGE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateCompletionResponse {
public static final String JSON_PROPERTY_ID = "id";
private String id;
public static final String JSON_PROPERTY_CHOICES = "choices";
private List<@Valid CreateCompletionResponseChoicesInner> choices;
public static final String JSON_PROPERTY_CREATED = "created";
private Integer created;
public static final String JSON_PROPERTY_MODEL = "model";
private String model;
public static final String JSON_PROPERTY_SYSTEM_FINGERPRINT = "system_fingerprint";
private String systemFingerprint;
/**
* The object type, which is always \"text_completion\"
*/
public enum ObjectEnum {
TEXT_COMPLETION("text_completion");
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 CompletionUsage usage;
public CreateCompletionResponse() {
}
public CreateCompletionResponse id(String id) {
this.id = id;
return this;
}
/**
* A unique identifier for the completion.
* @return id
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setId(String id) {
this.id = id;
}
public CreateCompletionResponse choices(List<@Valid CreateCompletionResponseChoicesInner> choices) {
this.choices = choices;
return this;
}
public CreateCompletionResponse addChoicesItem(CreateCompletionResponseChoicesInner choicesItem) {
if (this.choices == null) {
this.choices = new ArrayList<>();
}
this.choices.add(choicesItem);
return this;
}
/**
* The list of completion choices the model generated for the input prompt.
* @return choices
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<@Valid CreateCompletionResponseChoicesInner> getChoices() {
return choices;
}
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setChoices(List<@Valid CreateCompletionResponseChoicesInner> choices) {
this.choices = choices;
}
public CreateCompletionResponse created(Integer created) {
this.created = created;
return this;
}
/**
* The Unix timestamp (in seconds) of when the completion was created.
* @return created
*/
@jakarta.annotation.Nonnull
@NotNull
@JsonProperty(JSON_PROPERTY_CREATED)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public Integer getCreated() {
return created;
}
@JsonProperty(JSON_PROPERTY_CREATED)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setCreated(Integer created) {
this.created = created;
}
public CreateCompletionResponse model(String model) {
this.model = model;
return this;
}
/**
* The model used for completion.
* @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 CreateCompletionResponse systemFingerprint(String systemFingerprint) {
this.systemFingerprint = systemFingerprint;
return this;
}
/**
* This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
* @return systemFingerprint
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SYSTEM_FINGERPRINT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSystemFingerprint() {
return systemFingerprint;
}
@JsonProperty(JSON_PROPERTY_SYSTEM_FINGERPRINT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSystemFingerprint(String systemFingerprint) {
this.systemFingerprint = systemFingerprint;
}
public CreateCompletionResponse _object(ObjectEnum _object) {
this._object = _object;
return this;
}
/**
* The object type, which is always \"text_completion\"
* @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 CreateCompletionResponse usage(CompletionUsage usage) {
this.usage = usage;
return this;
}
/**
* Get usage
* @return usage
*/
@jakarta.annotation.Nullable
@Valid
@JsonProperty(JSON_PROPERTY_USAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public CompletionUsage getUsage() {
return usage;
}
@JsonProperty(JSON_PROPERTY_USAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUsage(CompletionUsage usage) {
this.usage = usage;
}
/**
* Return true if this CreateCompletionResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateCompletionResponse createCompletionResponse = (CreateCompletionResponse) o;
return Objects.equals(this.id, createCompletionResponse.id) &&
Objects.equals(this.choices, createCompletionResponse.choices) &&
Objects.equals(this.created, createCompletionResponse.created) &&
Objects.equals(this.model, createCompletionResponse.model) &&
Objects.equals(this.systemFingerprint, createCompletionResponse.systemFingerprint) &&
Objects.equals(this._object, createCompletionResponse._object) &&
Objects.equals(this.usage, createCompletionResponse.usage);
}
@Override
public int hashCode() {
return Objects.hash(id, choices, created, model, systemFingerprint, _object, usage);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateCompletionResponse {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" choices: ").append(toIndentedString(choices)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" model: ").append(toIndentedString(model)).append("\n");
sb.append(" systemFingerprint: ").append(toIndentedString(systemFingerprint)).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 ");
}
}