com.github.tjake.jlama.net.openai.model.CreateChatCompletionStreamResponse 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.CreateChatCompletionStreamResponseChoicesInner;
import com.github.tjake.jlama.net.openai.model.CreateChatCompletionStreamResponseUsage;
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 streamed chunk of a chat completion response returned by model, based on the provided input.
*/
@JsonPropertyOrder({
CreateChatCompletionStreamResponse.JSON_PROPERTY_ID,
CreateChatCompletionStreamResponse.JSON_PROPERTY_CHOICES,
CreateChatCompletionStreamResponse.JSON_PROPERTY_CREATED,
CreateChatCompletionStreamResponse.JSON_PROPERTY_MODEL,
CreateChatCompletionStreamResponse.JSON_PROPERTY_SERVICE_TIER,
CreateChatCompletionStreamResponse.JSON_PROPERTY_SYSTEM_FINGERPRINT,
CreateChatCompletionStreamResponse.JSON_PROPERTY_OBJECT,
CreateChatCompletionStreamResponse.JSON_PROPERTY_USAGE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class CreateChatCompletionStreamResponse {
public static final String JSON_PROPERTY_ID = "id";
private String id;
public static final String JSON_PROPERTY_CHOICES = "choices";
private List<@Valid CreateChatCompletionStreamResponseChoicesInner> choices;
public static final String JSON_PROPERTY_CREATED = "created";
private Integer created;
public static final String JSON_PROPERTY_MODEL = "model";
private String model;
/**
* The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.
*/
public enum ServiceTierEnum {
SCALE("scale"),
DEFAULT("default");
private String value;
ServiceTierEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ServiceTierEnum fromValue(String value) {
for (ServiceTierEnum b : ServiceTierEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}
public static final String JSON_PROPERTY_SERVICE_TIER = "service_tier";
private ServiceTierEnum serviceTier;
public static final String JSON_PROPERTY_SYSTEM_FINGERPRINT = "system_fingerprint";
private String systemFingerprint;
/**
* The object type, which is always `chat.completion.chunk`.
*/
public enum ObjectEnum {
CHAT_COMPLETION_CHUNK("chat.completion.chunk");
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 CreateChatCompletionStreamResponseUsage usage;
public CreateChatCompletionStreamResponse() {
}
public CreateChatCompletionStreamResponse id(String id) {
this.id = id;
return this;
}
/**
* A unique identifier for the chat completion. Each chunk has the same ID.
* @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 CreateChatCompletionStreamResponse choices(List<@Valid CreateChatCompletionStreamResponseChoicesInner> choices) {
this.choices = choices;
return this;
}
public CreateChatCompletionStreamResponse addChoicesItem(CreateChatCompletionStreamResponseChoicesInner choicesItem) {
if (this.choices == null) {
this.choices = new ArrayList<>();
}
this.choices.add(choicesItem);
return this;
}
/**
* A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the last chunk if you set `stream_options: {\"include_usage\": true}`.
* @return choices
*/
@jakarta.annotation.Nonnull
@NotNull
@Valid
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<@Valid CreateChatCompletionStreamResponseChoicesInner> getChoices() {
return choices;
}
@JsonProperty(JSON_PROPERTY_CHOICES)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setChoices(List<@Valid CreateChatCompletionStreamResponseChoicesInner> choices) {
this.choices = choices;
}
public CreateChatCompletionStreamResponse created(Integer created) {
this.created = created;
return this;
}
/**
* The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
* @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 CreateChatCompletionStreamResponse model(String model) {
this.model = model;
return this;
}
/**
* The model to generate the 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 CreateChatCompletionStreamResponse serviceTier(ServiceTierEnum serviceTier) {
this.serviceTier = serviceTier;
return this;
}
/**
* The service tier used for processing the request. This field is only included if the `service_tier` parameter is specified in the request.
* @return serviceTier
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SERVICE_TIER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ServiceTierEnum getServiceTier() {
return serviceTier;
}
@JsonProperty(JSON_PROPERTY_SERVICE_TIER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setServiceTier(ServiceTierEnum serviceTier) {
this.serviceTier = serviceTier;
}
public CreateChatCompletionStreamResponse 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 CreateChatCompletionStreamResponse _object(ObjectEnum _object) {
this._object = _object;
return this;
}
/**
* The object type, which is always `chat.completion.chunk`.
* @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 CreateChatCompletionStreamResponse usage(CreateChatCompletionStreamResponseUsage 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 CreateChatCompletionStreamResponseUsage getUsage() {
return usage;
}
@JsonProperty(JSON_PROPERTY_USAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUsage(CreateChatCompletionStreamResponseUsage usage) {
this.usage = usage;
}
/**
* Return true if this CreateChatCompletionStreamResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateChatCompletionStreamResponse createChatCompletionStreamResponse = (CreateChatCompletionStreamResponse) o;
return Objects.equals(this.id, createChatCompletionStreamResponse.id) &&
Objects.equals(this.choices, createChatCompletionStreamResponse.choices) &&
Objects.equals(this.created, createChatCompletionStreamResponse.created) &&
Objects.equals(this.model, createChatCompletionStreamResponse.model) &&
Objects.equals(this.serviceTier, createChatCompletionStreamResponse.serviceTier) &&
Objects.equals(this.systemFingerprint, createChatCompletionStreamResponse.systemFingerprint) &&
Objects.equals(this._object, createChatCompletionStreamResponse._object) &&
Objects.equals(this.usage, createChatCompletionStreamResponse.usage);
}
@Override
public int hashCode() {
return Objects.hash(id, choices, created, model, serviceTier, systemFingerprint, _object, usage);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateChatCompletionStreamResponse {\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(" serviceTier: ").append(toIndentedString(serviceTier)).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 ");
}
}