Class ChatCompletionStoreMessage.ContentPart
-
- All Implemented Interfaces:
public final class ChatCompletionStoreMessage.ContentPartLearn about text inputs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionStoreMessage.ContentPart.VisitorAn interface that defines how to map each variant of ContentPart to a value of type T.
-
Method Summary
-
-
Method Detail
-
chatCompletionContentPartText
final Optional<ChatCompletionContentPartText> chatCompletionContentPartText()
Learn about text inputs.
-
chatCompletionContentPartImage
final Optional<ChatCompletionContentPartImage> chatCompletionContentPartImage()
Learn about image inputs.
-
isChatCompletionContentPartText
final Boolean isChatCompletionContentPartText()
-
isChatCompletionContentPartImage
final Boolean isChatCompletionContentPartImage()
-
asChatCompletionContentPartText
final ChatCompletionContentPartText asChatCompletionContentPartText()
Learn about text inputs.
-
asChatCompletionContentPartImage
final ChatCompletionContentPartImage asChatCompletionContentPartImage()
Learn about image inputs.
-
accept
final <T extends Any> T accept(ChatCompletionStoreMessage.ContentPart.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 = contentPart.accept(new ContentPart.Visitor<Optional<String>>() { @Override public Optional<String> visitChatCompletionContentPartText(ChatCompletionContentPartText chatCompletionContentPartText) { return Optional.of(chatCompletionContentPartText.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatCompletionStoreMessage.ContentPart 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.
-
ofChatCompletionContentPartText
final static ChatCompletionStoreMessage.ContentPart ofChatCompletionContentPartText(ChatCompletionContentPartText chatCompletionContentPartText)
Learn about text inputs.
-
ofChatCompletionContentPartImage
final static ChatCompletionStoreMessage.ContentPart ofChatCompletionContentPartImage(ChatCompletionContentPartImage chatCompletionContentPartImage)
Learn about image inputs.
-
-
-
-