Class StructuredChatCompletion
-
- All Implemented Interfaces:
public final class StructuredChatCompletion<T extends Object>
A wrapper for ChatCompletion that provides type-safe access to the choices when using the Structured Outputs feature to deserialize a JSON response to an instance of an arbitrary class. See the SDK documentation for more details on Structured Outputs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
StructuredChatCompletion.Choice
-
Field Summary
Fields Modifier and Type Field Description private final Class<T>
responseType
private final ChatCompletion
rawChatCompletion
-
Constructor Summary
Constructors Constructor Description StructuredChatCompletion(Class<T> responseType, ChatCompletion rawChatCompletion)
-
Method Summary
Modifier and Type Method Description final Class<T>
responseType()
final ChatCompletion
rawChatCompletion()
final String
id()
final List<StructuredChatCompletion.Choice<T>>
choices()
final Long
created()
final String
model()
final JsonValue
_object_()
final Optional<ChatCompletion.ServiceTier>
serviceTier()
final Optional<String>
systemFingerprint()
final Optional<CompletionUsage>
usage()
final JsonField<String>
_id()
final JsonField<List<StructuredChatCompletion.Choice<T>>>
_choices()
final JsonField<Long>
_created()
final JsonField<String>
_model()
final JsonField<ChatCompletion.ServiceTier>
_serviceTier()
final JsonField<String>
_systemFingerprint()
final JsonField<CompletionUsage>
_usage()
final Map<String, JsonValue>
_additionalProperties()
final StructuredChatCompletion<T>
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
-
-
Constructor Detail
-
StructuredChatCompletion
StructuredChatCompletion(Class<T> responseType, ChatCompletion rawChatCompletion)
-
-
Method Detail
-
responseType
final Class<T> responseType()
-
rawChatCompletion
final ChatCompletion rawChatCompletion()
-
choices
final List<StructuredChatCompletion.Choice<T>> choices()
-
serviceTier
final Optional<ChatCompletion.ServiceTier> serviceTier()
-
systemFingerprint
final Optional<String> systemFingerprint()
-
usage
final Optional<CompletionUsage> usage()
-
_choices
final JsonField<List<StructuredChatCompletion.Choice<T>>> _choices()
-
_serviceTier
final JsonField<ChatCompletion.ServiceTier> _serviceTier()
-
_systemFingerprint
final JsonField<String> _systemFingerprint()
-
_usage
final JsonField<CompletionUsage> _usage()
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
validate
final StructuredChatCompletion<T> validate()
-
-
-
-