Class MessageContentPartParam
-
- All Implemented Interfaces:
public final class MessageContentPartParamReferences an image File in the content of a message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMessageContentPartParam.VisitorAn interface that defines how to map each variant of MessageContentPartParam to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ImageFileContentBlock>imageFile()References an image File in the content of a message. final Optional<ImageUrlContentBlock>imageUrl()References an image URL in the content of a message. final Optional<TextContentBlockParam>text()The text content that is part of a message. final BooleanisImageFile()final BooleanisImageUrl()final BooleanisText()final ImageFileContentBlockasImageFile()References an image File in the content of a message. final ImageUrlContentBlockasImageUrl()References an image URL in the content of a message. final TextContentBlockParamasText()The text content that is part of a message. final Optional<JsonValue>_json()final <T extends Any> Taccept(MessageContentPartParam.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final MessageContentPartParamvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static MessageContentPartParamofImageFile(ImageFileContentBlock imageFile)References an image File in the content of a message. final static MessageContentPartParamofImageUrl(ImageUrlContentBlock imageUrl)References an image URL in the content of a message. final static MessageContentPartParamofText(TextContentBlockParam text)The text content that is part of a message. -
-
Method Detail
-
imageFile
final Optional<ImageFileContentBlock> imageFile()
References an image File in the content of a message.
-
imageUrl
final Optional<ImageUrlContentBlock> imageUrl()
References an image URL in the content of a message.
-
text
final Optional<TextContentBlockParam> text()
The text content that is part of a message.
-
isImageFile
final Boolean isImageFile()
-
isImageUrl
final Boolean isImageUrl()
-
asImageFile
final ImageFileContentBlock asImageFile()
References an image File in the content of a message.
-
asImageUrl
final ImageUrlContentBlock asImageUrl()
References an image URL in the content of a message.
-
asText
final TextContentBlockParam asText()
The text content that is part of a message.
-
accept
final <T extends Any> T accept(MessageContentPartParam.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 = messageContentPartParam.accept(new MessageContentPartParam.Visitor<Optional<String>>() { @Override public Optional<String> visitImageFile(ImageFileContentBlock imageFile) { return Optional.of(imageFile.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final MessageContentPartParam 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.
-
ofImageFile
final static MessageContentPartParam ofImageFile(ImageFileContentBlock imageFile)
References an image File in the content of a message.
-
ofImageUrl
final static MessageContentPartParam ofImageUrl(ImageUrlContentBlock imageUrl)
References an image URL in the content of a message.
-
ofText
final static MessageContentPartParam ofText(TextContentBlockParam text)
The text content that is part of a message.
-
-
-
-