Completion Choice
data class CompletionChoice(val text: String, val index: Int, val logprobs: List<Float>?, val finishReason: FinishReason)
The OpenAI API returns a list of CompletionChoice
. Each choice has a generated message (CompletionChoice.text) and a finish reason (CompletionChoice.finishReason). For most use cases, you only need the generated text.
By default, only 1 choice is generated (since CompletionRequest.n == 1). When you increase n
or provide a list of prompts (called batching), there will be multiple choices.