Class MessageContentDelta
-
- All Implemented Interfaces:
public final class MessageContentDeltaReferences an image File in the content of a message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMessageContentDelta.VisitorAn interface that defines how to map each variant of MessageContentDelta to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ImageFileDeltaBlock>imageFile()References an image File in the content of a message. final Optional<TextDeltaBlock>text()The text content that is part of a message. final Optional<RefusalDeltaBlock>refusal()The refusal content that is part of a message. final Optional<ImageUrlDeltaBlock>imageUrl()References an image URL in the content of a message. final BooleanisImageFile()final BooleanisText()final BooleanisRefusal()final BooleanisImageUrl()final ImageFileDeltaBlockasImageFile()References an image File in the content of a message. final TextDeltaBlockasText()The text content that is part of a message. final RefusalDeltaBlockasRefusal()The refusal content that is part of a message. final ImageUrlDeltaBlockasImageUrl()References an image URL in the content of a message. final Optional<JsonValue>_json()final <T extends Any> Taccept(MessageContentDelta.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final MessageContentDeltavalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static MessageContentDeltaofImageFile(ImageFileDeltaBlock imageFile)References an image File in the content of a message. final static MessageContentDeltaofText(TextDeltaBlock text)The text content that is part of a message. final static MessageContentDeltaofRefusal(RefusalDeltaBlock refusal)The refusal content that is part of a message. final static MessageContentDeltaofImageUrl(ImageUrlDeltaBlock imageUrl)References an image URL in the content of a message. -
-
Method Detail
-
imageFile
final Optional<ImageFileDeltaBlock> imageFile()
References an image File in the content of a message.
-
text
final Optional<TextDeltaBlock> text()
The text content that is part of a message.
-
refusal
final Optional<RefusalDeltaBlock> refusal()
The refusal content that is part of a message.
-
imageUrl
final Optional<ImageUrlDeltaBlock> imageUrl()
References an image URL in the content of a message.
-
isImageFile
final Boolean isImageFile()
-
isImageUrl
final Boolean isImageUrl()
-
asImageFile
final ImageFileDeltaBlock asImageFile()
References an image File in the content of a message.
-
asText
final TextDeltaBlock asText()
The text content that is part of a message.
-
asRefusal
final RefusalDeltaBlock asRefusal()
The refusal content that is part of a message.
-
asImageUrl
final ImageUrlDeltaBlock asImageUrl()
References an image URL in the content of a message.
-
accept
final <T extends Any> T accept(MessageContentDelta.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 = messageContentDelta.accept(new MessageContentDelta.Visitor<Optional<String>>() { @Override public Optional<String> visitImageFile(ImageFileDeltaBlock imageFile) { return Optional.of(imageFile.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final MessageContentDelta 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 MessageContentDelta ofImageFile(ImageFileDeltaBlock imageFile)
References an image File in the content of a message.
-
ofText
final static MessageContentDelta ofText(TextDeltaBlock text)
The text content that is part of a message.
-
ofRefusal
final static MessageContentDelta ofRefusal(RefusalDeltaBlock refusal)
The refusal content that is part of a message.
-
ofImageUrl
final static MessageContentDelta ofImageUrl(ImageUrlDeltaBlock imageUrl)
References an image URL in the content of a message.
-
-
-
-