com.github.tjake.jlama.net.openai.model.CreateChatCompletionFunctionResponse 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
The newest version!
/*
* 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.CreateChatCompletionFunctionResponseChoicesInner;
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 chat completion response returned by model, based on the provided input.
*/
@JsonPropertyOrder({
CreateChatCompletionFunctionResponse.JSON_PROPERTY_ID,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_CHOICES,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_CREATED,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_MODEL,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_SYSTEM_FINGERPRINT,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_OBJECT,
CreateChatCompletionFunctionResponse.JSON_PROPERTY_USAGE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateChatCompletionFunctionResponse {
public static final String JSON_PROPERTY_ID = "id";
private String id;
public static final String JSON_PROPERTY_CHOICES = "choices";
private List<@Valid CreateChatCompletionFunctionResponseChoicesInner> 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 `chat.completion`.
*/
public enum ObjectEnum {
CHAT_COMPLETION("chat.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 CreateChatCompletionFunctionResponse() {
}
public CreateChatCompletionFunctionResponse id(String id) {
this.id = id;
return this;
}
/**
* A unique identifier for the chat 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 CreateChatCompletionFunctionResponse choices(List<@Valid CreateChatCompletionFunctionResponseChoicesInner> choices) {
this.choices = choices;
return this;
}
public CreateChatCompletionFunctionResponse addChoicesItem(CreateChatCompletionFunctionResponseChoicesInner choicesItem) {
if (this.choices == null) {
this.choices = new ArrayList<>();
}
this.choices.add(choicesItem);
return this;
}
/**
* A list of chat completion choices. Can be more than one if `n` is greater than 1.
* @return choices
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<@Valid CreateChatCompletionFunctionResponseChoicesInner> getChoices() {
return choices;
}
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setChoices(List<@Valid CreateChatCompletionFunctionResponseChoicesInner> choices) {
this.choices = choices;
}
public CreateChatCompletionFunctionResponse created(Integer created) {
this.created = created;
return this;
}
/**
* The Unix timestamp (in seconds) of when the chat 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 CreateChatCompletionFunctionResponse model(String model) {
this.model = model;
return this;
}
/**
* The model used for the chat 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 CreateChatCompletionFunctionResponse 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 CreateChatCompletionFunctionResponse _object(ObjectEnum _object) {
this._object = _object;
return this;
}
/**
* The object type, which is always `chat.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 CreateChatCompletionFunctionResponse 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 CreateChatCompletionFunctionResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateChatCompletionFunctionResponse createChatCompletionFunctionResponse = (CreateChatCompletionFunctionResponse) o;
return Objects.equals(this.id, createChatCompletionFunctionResponse.id) &&
Objects.equals(this.choices, createChatCompletionFunctionResponse.choices) &&
Objects.equals(this.created, createChatCompletionFunctionResponse.created) &&
Objects.equals(this.model, createChatCompletionFunctionResponse.model) &&
Objects.equals(this.systemFingerprint, createChatCompletionFunctionResponse.systemFingerprint) &&
Objects.equals(this._object, createChatCompletionFunctionResponse._object) &&
Objects.equals(this.usage, createChatCompletionFunctionResponse.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 CreateChatCompletionFunctionResponse {\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 ");
}
}