OpenAIChoice

@Serializable
data class OpenAIChoice(val index: Int, val message: OpenAIMessage, val finishReason: String? = null, val logprobs: OpenAIChoiceLogprobs? = null) : Mapper<ChatChoice>

A choice in an OpenAI chat completion response.

Example:

{
"index": 0,
"message": { "role": "assistant", "content": "Hello!" },
"finish_reason": "stop"
}

Constructors

Link copied to clipboard
constructor(index: Int, message: OpenAIMessage, finishReason: String? = null, logprobs: OpenAIChoiceLogprobs? = null)

Properties

Link copied to clipboard
@SerialName(value = "finish_reason")
val finishReason: String?

Why the model stopped: "stop", "length", "tool_calls", "content_filter" or "function_call" (deprecated). null while still generating.

Link copied to clipboard
val index: Int

The index of this choice.

Link copied to clipboard

Log probability information for the choice. Only present when logprobs is set to true in the request. null otherwise.

Link copied to clipboard

The message returned by the model.

Functions

Link copied to clipboard
open override fun map(): ChatChoice
Link copied to clipboard

Converts this to a core ChatChoice.