ChatChoice

data class ChatChoice(val index: Int, val message: ChatMessage, val finishReason: FinishReason)

The OpenAI API returns a list of ChatChoice. Each choice has a generated message (ChatChoice.message) and a finish reason (ChatChoice.finishReason). For most use cases, you only need the generated message.

By default, only 1 ChatChoice is generated (since ChatRequest.n == 1). When you increase n, more options are generated. The more options you generate, the more tokens you use. In general, it is best to ONLY generate 1 response, and to let the user regenerate the response.

See also

Constructors

Link copied to clipboard
constructor(index: Int, message: ChatMessage, finishReason: FinishReason)

Create a new chat choice, for internal usage.

Properties

Link copied to clipboard

The reason the bot stopped generating tokens.

Link copied to clipboard
val index: Int

The index in the array... 0 if ChatRequest.n=1.

Link copied to clipboard

The generated text.