Class ThreadCreateParams.Message.Content
-
- All Implemented Interfaces:
public final class ThreadCreateParams.Message.ContentThe text contents of the message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceThreadCreateParams.Message.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>text()The text contents of the message. final Optional<List<MessageContentPartParam>>arrayOfContentParts()An array of content parts with a defined type, each can be of type textor images can be passed withimage_urlorimage_file.final BooleanisText()final BooleanisArrayOfContentParts()final StringasText()The text contents of the message. final List<MessageContentPartParam>asArrayOfContentParts()An array of content parts with a defined type, each can be of type textor images can be passed withimage_urlorimage_file.final Optional<JsonValue>_json()final <T extends Any> Taccept(ThreadCreateParams.Message.Content.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ThreadCreateParams.Message.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 ThreadCreateParams.Message.ContentofText(String text)The text contents of the message. final static ThreadCreateParams.Message.ContentofArrayOfContentParts(List<MessageContentPartParam> arrayOfContentParts)An array of content parts with a defined type, each can be of type textor images can be passed withimage_urlorimage_file.-
-
Method Detail
-
arrayOfContentParts
final Optional<List<MessageContentPartParam>> arrayOfContentParts()
An array of content parts with a defined type, each can be of type
textor images can be passed withimage_urlorimage_file. Image types are only supported on Vision-compatible models.
-
isArrayOfContentParts
final Boolean isArrayOfContentParts()
-
asArrayOfContentParts
final List<MessageContentPartParam> asArrayOfContentParts()
An array of content parts with a defined type, each can be of type
textor images can be passed withimage_urlorimage_file. Image types are only supported on Vision-compatible models.
-
accept
final <T extends Any> T accept(ThreadCreateParams.Message.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> visitText(String text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ThreadCreateParams.Message.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.
-
ofText
final static ThreadCreateParams.Message.Content ofText(String text)
The text contents of the message.
-
ofArrayOfContentParts
final static ThreadCreateParams.Message.Content ofArrayOfContentParts(List<MessageContentPartParam> arrayOfContentParts)
An array of content parts with a defined type, each can be of type
textor images can be passed withimage_urlorimage_file. Image types are only supported on Vision-compatible models.
-
-
-
-