Class ChatCompletion
-
- All Implemented Interfaces:
public final class ChatCompletion
Represents a chat completion response returned by model, based on the provided input.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ChatCompletion.Builder
A builder for ChatCompletion.
public final class
ChatCompletion.Choice
public final class
ChatCompletion.ServiceTier
The service tier used for processing the request.
-
Method Summary
Modifier and Type Method Description final String
id()
A unique identifier for the chat completion. final List<ChatCompletion.Choice>
choices()
A list of chat completion choices. final Long
created()
The Unix timestamp (in seconds) of when the chat completion was created. final String
model()
The model used for the chat completion. final JsonValue
_object_()
The object type, which is always chat.completion
.final Optional<ChatCompletion.ServiceTier>
serviceTier()
The service tier used for processing the request. final Optional<String>
systemFingerprint()
This fingerprint represents the backend configuration that the model runs with. final Optional<CompletionUsage>
usage()
Usage statistics for the completion request. final JsonField<String>
_id()
Returns the raw JSON value of id. final JsonField<List<ChatCompletion.Choice>>
_choices()
Returns the raw JSON value of choices. final JsonField<Long>
_created()
Returns the raw JSON value of created. final JsonField<String>
_model()
Returns the raw JSON value of model. final JsonField<ChatCompletion.ServiceTier>
_serviceTier()
Returns the raw JSON value of serviceTier. final JsonField<String>
_systemFingerprint()
Returns the raw JSON value of systemFingerprint. final JsonField<CompletionUsage>
_usage()
Returns the raw JSON value of usage. final Map<String, JsonValue>
_additionalProperties()
final ChatCompletion.Builder
toBuilder()
final ChatCompletion
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ChatCompletion.Builder
builder()
Returns a mutable builder for constructing an instance of ChatCompletion. -
-
Method Detail
-
choices
final List<ChatCompletion.Choice> choices()
A list of chat completion choices. Can be more than one if
n
is greater than 1.
-
created
final Long created()
The Unix timestamp (in seconds) of when the chat completion was created.
-
_object_
final JsonValue _object_()
The object type, which is always
chat.completion
.Expected to always return the following:
JsonValue.from("chat.completion")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
serviceTier
final Optional<ChatCompletion.ServiceTier> serviceTier()
The service tier used for processing the request.
-
systemFingerprint
final Optional<String> systemFingerprint()
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.
-
usage
final Optional<CompletionUsage> usage()
Usage statistics for the completion request.
-
_id
final JsonField<String> _id()
Returns the raw JSON value of id.
Unlike id, this method doesn't throw if the JSON field has an unexpected type.
-
_choices
final JsonField<List<ChatCompletion.Choice>> _choices()
Returns the raw JSON value of choices.
Unlike choices, this method doesn't throw if the JSON field has an unexpected type.
-
_created
final JsonField<Long> _created()
Returns the raw JSON value of created.
Unlike created, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<String> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_serviceTier
final JsonField<ChatCompletion.ServiceTier> _serviceTier()
Returns the raw JSON value of serviceTier.
Unlike serviceTier, this method doesn't throw if the JSON field has an unexpected type.
-
_systemFingerprint
final JsonField<String> _systemFingerprint()
Returns the raw JSON value of systemFingerprint.
Unlike systemFingerprint, this method doesn't throw if the JSON field has an unexpected type.
-
_usage
final JsonField<CompletionUsage> _usage()
Returns the raw JSON value of usage.
Unlike usage, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ChatCompletion.Builder toBuilder()
-
validate
final ChatCompletion validate()
-
builder
final static ChatCompletion.Builder builder()
Returns a mutable builder for constructing an instance of ChatCompletion.
The following fields are required:
.id() .choices() .created() .model()
-
-
-
-