Class Completion
-
- All Implemented Interfaces:
public final class Completion
Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
Completion.Builder
A builder for Completion.
-
Method Summary
Modifier and Type Method Description final String
id()
A unique identifier for the completion. final List<CompletionChoice>
choices()
The list of completion choices the model generated for the input prompt. final Long
created()
The Unix timestamp (in seconds) of when the completion was created. final String
model()
The model used for completion. final JsonValue
_object_()
The object type, which is always "text_completion"Expected to always return the following:
However, this method can be useful for debugging and logging (e.g.JsonValue.from("text_completion")
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<CompletionChoice>>
_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<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 Completion.Builder
toBuilder()
final Completion
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static Completion.Builder
builder()
Returns a mutable builder for constructing an instance of Completion. -
-
Method Detail
-
choices
final List<CompletionChoice> choices()
The list of completion choices the model generated for the input prompt.
-
_object_
final JsonValue _object_()
The object type, which is always "text_completion"
Expected to always return the following:
JsonValue.from("text_completion")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
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<CompletionChoice>> _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.
-
_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 Completion.Builder toBuilder()
-
validate
final Completion validate()
-
builder
final static Completion.Builder builder()
Returns a mutable builder for constructing an instance of Completion.
The following fields are required:
.id() .choices() .created() .model()
-
-
-
-