Class ChatCompletionAssistantMessageParam.Content
-
- All Implemented Interfaces:
public final class ChatCompletionAssistantMessageParam.ContentThe contents of the assistant message. Required unless
tool_callsorfunction_callis specified.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionAssistantMessageParam.Content.VisitorAn interface that defines how to map each variant of Content to a value of type T.
public final classChatCompletionAssistantMessageParam.Content.ChatCompletionRequestAssistantMessageContentPartLearn about text inputs.
-
Method Summary
-
-
Method Detail
-
arrayOfContentParts
final Optional<List<ChatCompletionAssistantMessageParam.Content.ChatCompletionRequestAssistantMessageContentPart>> arrayOfContentParts()
An array of content parts with a defined type. Can be one or more of type
text, or exactly one of typerefusal.
-
isArrayOfContentParts
final Boolean isArrayOfContentParts()
-
asArrayOfContentParts
final List<ChatCompletionAssistantMessageParam.Content.ChatCompletionRequestAssistantMessageContentPart> asArrayOfContentParts()
An array of content parts with a defined type. Can be one or more of type
text, or exactly one of typerefusal.
-
accept
final <T extends Any> T accept(ChatCompletionAssistantMessageParam.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 ChatCompletionAssistantMessageParam.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 ChatCompletionAssistantMessageParam.Content ofText(String text)
The contents of the assistant message.
-
ofArrayOfContentParts
final static ChatCompletionAssistantMessageParam.Content ofArrayOfContentParts(List<ChatCompletionAssistantMessageParam.Content.ChatCompletionRequestAssistantMessageContentPart> arrayOfContentParts)
An array of content parts with a defined type. Can be one or more of type
text, or exactly one of typerefusal.
-
-
-
-