Class ChatCompletionPredictionContent.Content
-
- All Implemented Interfaces:
public final class ChatCompletionPredictionContent.ContentThe content that should be matched when generating a model response. If generated tokens would match this content, the entire model response can be returned much more quickly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionPredictionContent.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 content used for a Predicted Output. final Optional<List<ChatCompletionContentPartText>>arrayOfContentParts()An array of content parts with a defined type. final BooleanisText()final BooleanisArrayOfContentParts()final StringasText()The content used for a Predicted Output. final List<ChatCompletionContentPartText>asArrayOfContentParts()An array of content parts with a defined type. final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatCompletionPredictionContent.Content.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatCompletionPredictionContent.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 ChatCompletionPredictionContent.ContentofText(String text)The content used for a Predicted Output. final static ChatCompletionPredictionContent.ContentofArrayOfContentParts(List<ChatCompletionContentPartText> arrayOfContentParts)An array of content parts with a defined type. -
-
Method Detail
-
text
final Optional<String> text()
The content used for a Predicted Output. This is often the text of a file you are regenerating with minor changes.
-
arrayOfContentParts
final Optional<List<ChatCompletionContentPartText>> arrayOfContentParts()
An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs.
-
isArrayOfContentParts
final Boolean isArrayOfContentParts()
-
asText
final String asText()
The content used for a Predicted Output. This is often the text of a file you are regenerating with minor changes.
-
asArrayOfContentParts
final List<ChatCompletionContentPartText> asArrayOfContentParts()
An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs.
-
accept
final <T extends Any> T accept(ChatCompletionPredictionContent.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 ChatCompletionPredictionContent.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 ChatCompletionPredictionContent.Content ofText(String text)
The content used for a Predicted Output. This is often the text of a file you are regenerating with minor changes.
-
ofArrayOfContentParts
final static ChatCompletionPredictionContent.Content ofArrayOfContentParts(List<ChatCompletionContentPartText> arrayOfContentParts)
An array of content parts with a defined type. Supported options differ based on the model being used to generate the response. Can contain text inputs.
-
-
-
-