ChatChoiceChunk

data class ChatChoiceChunk(val index: Int, var delta: ChatMessageDelta? = null, var finishReason: FinishReason?)

The OpenAI API returns a list of ChatChoiceChunk. The "new content" is saved to the delta property. To access everything that is currently generated, use message.

By default, only 1 ChatChoiceChunk 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.

Since

1.2.0

See also

Constructors

Link copied to clipboard
constructor(index: Int, delta: ChatMessageDelta? = null, finishReason: FinishReason?)

Create a new chat choice, for internal usage.

Functions

Link copied to clipboard

Returns true if this message chunk is complete. Once complete, no more tokens will be generated, and ChatChoiceChunk.message will contain the complete message.

Properties

Link copied to clipboard

The newly generated tokens (can be empty!)

Link copied to clipboard
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

All tokens that are currently generated.