Class StructuredMessage
-
- All Implemented Interfaces:
public final class StructuredMessage<T extends Object>A wrapper for BetaMessage that provides type-safe access to the content 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 classStructuredMessage.BuilderA builder for StructuredMessage.
-
Field Summary
Fields Modifier and Type Field Description private final Class<T>outputTypeprivate final BetaMessagerawMessage
-
Method Summary
-
-
Method Detail
-
outputType
final Class<T> outputType()
-
rawMessage
final BetaMessage rawMessage()
-
container
final Optional<BetaContainer> container()
-
content
final List<StructuredContentBlock<T>> content()
-
contextManagement
final Optional<BetaContextManagementResponse> contextManagement()
-
diagnostics
final Optional<BetaDiagnostics> diagnostics()
-
stopDetails
final Optional<BetaRefusalStopDetails> stopDetails()
-
stopReason
final Optional<BetaStopReason> stopReason()
-
stopSequence
final Optional<String> stopSequence()
-
inputTransformations
final Optional<List<BetaInputTransformation>> inputTransformations()
-
_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.
-
_container
final JsonField<BetaContainer> _container()
Returns the raw JSON value of container.
Unlike container, this method doesn't throw if the JSON field has an unexpected type.
-
_content
final JsonField<List<StructuredContentBlock<T>>> _content()
Returns the raw JSON value of content.
Unlike content, this method doesn't throw if the JSON field has an unexpected type.
-
_contextManagement
final JsonField<BetaContextManagementResponse> _contextManagement()
Returns the raw JSON value of contextManagement.
Unlike contextManagement, this method doesn't throw if the JSON field has an unexpected type.
-
_diagnostics
final JsonField<BetaDiagnostics> _diagnostics()
Returns the raw JSON value of diagnostics.
Unlike diagnostics, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<Model> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_stopDetails
final JsonField<BetaRefusalStopDetails> _stopDetails()
Returns the raw JSON value of stopDetails.
Unlike stopDetails, this method doesn't throw if the JSON field has an unexpected type.
-
_stopReason
final JsonField<BetaStopReason> _stopReason()
Returns the raw JSON value of stopReason.
Unlike stopReason, this method doesn't throw if the JSON field has an unexpected type.
-
_stopSequence
final JsonField<String> _stopSequence()
Returns the raw JSON value of stopSequence.
Unlike stopSequence, this method doesn't throw if the JSON field has an unexpected type.
-
_usage
final JsonField<BetaUsage> _usage()
Returns the raw JSON value of usage.
Unlike usage, this method doesn't throw if the JSON field has an unexpected type.
-
_inputTransformations
final JsonField<List<BetaInputTransformation>> _inputTransformations()
Returns the raw JSON value of inputTransformations.
Unlike inputTransformations, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
validate
final StructuredMessage<T> validate()
-
toBuilder
final StructuredMessage.Builder<T> toBuilder()
-
builder
final static <T extends Any> StructuredMessage.Builder<T> builder(Class<T> outputType)
Returns a mutable builder for constructing an instance of StructuredMessage.
The following fields are required:
.id() .container() .content() .contextManagement() .diagnostics() .model() .stopDetails() .stopReason() .stopSequence() .usage()
-
-
-
-