CompletionRequestBuilder

Builder of CompletionRequest instances.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var bestOf: Int?

Generates bestOf completions server-side and returns the "best" (the one with the lowest log probability per token). Results cannot be streamed.

Link copied to clipboard

Echo back the prompt in addition to the completion.

Link copied to clipboard

Number between 0 and 1 (default 0) that penalizes new tokens based on their existing frequency in the text so far. Decreases the model's likelihood to repeat the same line verbatim.

Link copied to clipboard

Modify the likelihood of specified tokens appearing in the completion.

Link copied to clipboard

Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 10, the API will return a list of the 10 most likely tokens. The API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response.

Link copied to clipboard

The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion. (One token is roughly 4 characters for normal English text)

Link copied to clipboard

ID of the model to use.

Link copied to clipboard
var n: Int?

How many completions to generate for each prompt.

Link copied to clipboard

Number between 0 and 1 (default 0) that penalizes new tokens based on whether they appear in the text so far. Increases the model's likelihood to talk about new topics.

Link copied to clipboard

The prompt(s) to generate completions for, encoded as a string, a list of strings, or a list of token lists.

Link copied to clipboard

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

Link copied to clipboard

The suffix that comes after a completion of inserted text.

Link copied to clipboard

What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.

Link copied to clipboard
var topP: Double?

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Link copied to clipboard
var user: String?

A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.

Functions

Link copied to clipboard