Completion Request
Holds the configurable options that can be sent to the OpenAI Completions API. For most use cases, you only need to set model and prompt. For more detailed descriptions for each option, refer to the Completions Wiki.
prompt can be either a singular String
, a List<String>
, or a String[]
. Providing multiple prompts is called batching, and it can be used to reduce rate limit errors. This will cause the CompletionResponse to have multiple choices.
You should not set stream. The stream option is handled using []
Constructors
Create a CompletionRequest instance. Recommend using builder instead.
Types
Builder
is a helper class to build a CompletionRequest instance with a stable API. It provides methods for setting the properties fo the CompletionRequest object. The build method returns a new CompletionRequest instance with the specified properties.
Properties
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
What sampling temperature to use, between 0 and 2.