ChatCompletionRequest

data class ChatCompletionRequest(val messages: List<Message>, val model: String, val store: Boolean = false, val reasoningEffort: String = "medium", val metadata: Metadata? = null, val maxCompletionTokens: Int? = null, val frequencyPenalty: Double? = 0.0, val responseFormat: ResponseFormat? = null, val temperature: Double = 1.0, val seed: Int? = null, val stream: Boolean = false, val streamOptions: ChatCompletionStreamOptions? = null, val tools: List<Tool>? = null)(source)

Represents a request for generating a chat-based completions in an OpenAI-like environment.

This data class is used for serialization and defines the parameters required to send a chat completions request, including the input messages, model to use, and various tuning parameters.

See also

Constructors

Link copied to clipboard
constructor(messages: List<Message>, model: String, store: Boolean = false, reasoningEffort: String = "medium", metadata: Metadata? = null, maxCompletionTokens: Int? = null, frequencyPenalty: Double? = 0.0, responseFormat: ResponseFormat? = null, temperature: Double = 1.0, seed: Int? = null, stream: Boolean = false, streamOptions: ChatCompletionStreamOptions? = null, tools: List<Tool>? = null)

Properties

Link copied to clipboard
@SerialName(value = "frequency_penalty")
val frequencyPenalty: Double?

The penalty value for repetitive token usage in the response.

Link copied to clipboard
@SerialName(value = "max_completion_tokens")
val maxCompletionTokens: Int?

The maximum number of tokens allowed in the generated completions.

Link copied to clipboard

A list of input messages that define the conversation context, each with a role and content.

Link copied to clipboard

Optional metadata associated with the request, such as tags.

Link copied to clipboard

The identifier of the language model to be used for generating the completions.

Link copied to clipboard
@SerialName(value = "reasoning_effort")
val reasoningEffort: String

Specifies the level of computational effort to apply during reasoning ("low", "medium", "high").

Link copied to clipboard
@SerialName(value = "response_format")
val responseFormat: ResponseFormat?

Defines the response format, including optional JSON schema support.

Link copied to clipboard
val seed: Int?

Can be used to produce deterministic responses in testing.

Link copied to clipboard

A flag indicating whether the conversation context should be stored for further use.

Link copied to clipboard
Link copied to clipboard
@SerialName(value = "stream_options")
val streamOptions: ChatCompletionStreamOptions?
Link copied to clipboard

A value between 0.0 and 1.0 that controls the randomness of the generated response.

Link copied to clipboard
val tools: List<Tool>?