Class CompletionCreateParams.Prompt
-
- All Implemented Interfaces:
public final class CompletionCreateParams.PromptThe prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCompletionCreateParams.Prompt.VisitorAn interface that defines how to map each variant of Prompt to a value of type T.
-
Method Summary
-
-
Method Detail
-
arrayOfStrings
final Optional<List<String>> arrayOfStrings()
-
arrayOfTokens
final Optional<List<Long>> arrayOfTokens()
-
arrayOfTokenArrays
final Optional<List<List<Long>>> arrayOfTokenArrays()
-
isArrayOfStrings
final Boolean isArrayOfStrings()
-
isArrayOfTokens
final Boolean isArrayOfTokens()
-
isArrayOfTokenArrays
final Boolean isArrayOfTokenArrays()
-
asArrayOfStrings
final List<String> asArrayOfStrings()
-
asArrayOfTokens
final List<Long> asArrayOfTokens()
-
asArrayOfTokenArrays
final List<List<Long>> asArrayOfTokenArrays()
-
accept
final <T extends Any> T accept(CompletionCreateParams.Prompt.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 = prompt.accept(new Prompt.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final CompletionCreateParams.Prompt 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.
-
ofString
final static CompletionCreateParams.Prompt ofString(String string)
-
ofArrayOfStrings
final static CompletionCreateParams.Prompt ofArrayOfStrings(List<String> arrayOfStrings)
-
ofArrayOfTokens
final static CompletionCreateParams.Prompt ofArrayOfTokens(List<Long> arrayOfTokens)
-
ofArrayOfTokenArrays
final static CompletionCreateParams.Prompt ofArrayOfTokenArrays(List<List<Long>> arrayOfTokenArrays)
-
-
-
-