create_completion {openai} | R Documentation |
Create completion
Description
Creates a completion based on the provided prompt and parameters. See this page for details.
Usage
create_completion(
engine_id = deprecated(),
model,
prompt = "<|endoftext|>",
suffix = NULL,
max_tokens = 16,
temperature = 1,
top_p = 1,
n = 1,
stream = FALSE,
logprobs = NULL,
echo = FALSE,
stop = NULL,
presence_penalty = 0,
frequency_penalty = 0,
best_of = 1,
logit_bias = NULL,
user = NULL,
openai_api_key = Sys.getenv("OPENAI_API_KEY"),
openai_organization = NULL
)
Arguments
engine_id |
|
model |
required; a length one character vector. |
prompt |
required; defaults to |
suffix |
optional; defaults to |
max_tokens |
required; defaults to |
temperature |
required; defaults to |
top_p |
required; defaults to |
n |
required; defaults to |
stream |
required; defaults to |
logprobs |
optional; defaults to |
echo |
required; defaults to |
stop |
optional; defaults to |
presence_penalty |
required; defaults to |
frequency_penalty |
required; defaults to |
best_of |
required; defaults to |
logit_bias |
optional; defaults to |
user |
optional; defaults to |
openai_api_key |
required; defaults to |
openai_organization |
optional; defaults to |
Details
For arguments description please refer to the official documentation.
Value
Returns a list, elements of which contain completion(s) and supplementary information.
Examples
## Not run:
create_completion(
model = "text-davinci-002",
prompt = "Say this is a test",
max_tokens = 5
)
logit_bias <- list(
"11" = -100,
"13" = -100
)
create_completion(
model = "ada",
prompt = "Generate a question and an answer",
n = 4,
best_of = 4,
logit_bias = logit_bias
)
## End(Not run)