Class EasyInputMessage.Content
-
- All Implemented Interfaces:
public final class EasyInputMessage.ContentText, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEasyInputMessage.Content.VisitorAn interface that defines how to map each variant of Content to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>textInput()A text input to the model. final Optional<List<ResponseInputContent>>responseInputMessageContentList()A list of one or many input items to the model, containing different content types. final BooleanisTextInput()final BooleanisResponseInputMessageContentList()final StringasTextInput()A text input to the model. final List<ResponseInputContent>asResponseInputMessageContentList()A list of one or many input items to the model, containing different content types. final Optional<JsonValue>_json()final <T extends Any> Taccept(EasyInputMessage.Content.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final EasyInputMessage.Contentvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static EasyInputMessage.ContentofTextInput(String textInput)A text input to the model. final static EasyInputMessage.ContentofResponseInputMessageContentList(List<ResponseInputContent> responseInputMessageContentList)A list of one or many input items to the model, containing different content types. -
-
Method Detail
-
responseInputMessageContentList
final Optional<List<ResponseInputContent>> responseInputMessageContentList()
A list of one or many input items to the model, containing different content types.
-
isTextInput
final Boolean isTextInput()
-
isResponseInputMessageContentList
final Boolean isResponseInputMessageContentList()
-
asTextInput
final String asTextInput()
A text input to the model.
-
asResponseInputMessageContentList
final List<ResponseInputContent> asResponseInputMessageContentList()
A list of one or many input items to the model, containing different content types.
-
accept
final <T extends Any> T accept(EasyInputMessage.Content.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = content.accept(new Content.Visitor<Optional<String>>() { @Override public Optional<String> visitTextInput(String textInput) { return Optional.of(textInput.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final EasyInputMessage.Content validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofTextInput
final static EasyInputMessage.Content ofTextInput(String textInput)
A text input to the model.
-
ofResponseInputMessageContentList
final static EasyInputMessage.Content ofResponseInputMessageContentList(List<ResponseInputContent> responseInputMessageContentList)
A list of one or many input items to the model, containing different content types.
-
-
-
-