ChatCompletionParams

Parameters for configuring chat completion requests to DeepSeek models.

This class encapsulates all the options available when sending chat completion requests, allowing fine-grained control over the model's behavior and output.

Example:

val params = chatCompletionParams {
model = ChatModel.DEEPSEEK_FLASH
temperature = 0.7
maxTokens = 1000
}

client.chat(params, messages)

Types

Link copied to clipboard
class Builder

Builder for creating ChatCompletionParams with standard (non-streaming) configuration.

Link copied to clipboard

Builder for creating ChatCompletionParams specifically configured for streaming responses.

Properties

Link copied to clipboard

Sent as frequency_penalty, ignored by the API.

Link copied to clipboard

Whether to return log probabilities of output tokens

Link copied to clipboard

Maximum number of tokens to generate in the response. At least 1, and otherwise bounded by the model's context length.

Link copied to clipboard

The DeepSeek model to use for chat completion; defaults to ChatModel.DEEPSEEK_FLASH

Link copied to clipboard

Sent as presence_penalty, ignored by the API.

Link copied to clipboard

How much reasoning the model spends before answering, while thinking mode is on; defaults to the API's own high. See ReasoningEffort.

Link copied to clipboard

Format specification for the model's output

Link copied to clipboard

Custom stop sequences that cause the model to stop generating further tokens.

Link copied to clipboard

Whether to stream the response back piece by piece

Link copied to clipboard

Configuration options for streaming responses

Link copied to clipboard

Controls randomness in output generation (higher = more random). Expected range: 0.0..2.0.

Link copied to clipboard

Switches the model between thinking and non-thinking mode. See Thinking.

Link copied to clipboard

Controls how the model selects tools to use

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

List of tools that the model may use during chat completion

Link copied to clipboard

How many most likely tokens to return at each position (max 20)

Link copied to clipboard
val topP: Double?

Controls diversity via nucleus sampling (consider only tokens with top_p probability mass). Expected range: 0.0..1.0.

Link copied to clipboard

Custom identifier of the end user behind the request; 1 to 512 characters from [a-zA-Z0-9\-_]. Must not carry personal data.

Functions

Link copied to clipboard

Shortcut to chatCompletionParams, available on any existing DeepSeekParams.

Link copied to clipboard
Link copied to clipboard
fun copy(model: ChatModel = this.model, frequencyPenalty: Double? = this.frequencyPenalty, maxTokens: Int? = this.maxTokens, presencePenalty: Double? = this.presencePenalty, responseFormat: ResponseFormat? = this.responseFormat, stop: StopReason? = this.stop, stream: Boolean? = this.stream, streamOptions: StreamOptions? = this.streamOptions, temperature: Double? = this.temperature, topP: Double? = this.topP, tools: List<Tool>? = this.tools, toolChoice: ToolChoice? = this.toolChoice, logprobs: Boolean? = this.logprobs, topLogprobs: Int? = this.topLogprobs, thinking: Thinking? = this.thinking, reasoningEffort: ReasoningEffort? = this.reasoningEffort, userId: String? = this.userId): ChatCompletionParams

Creates a copy of these parameters with optional changes to specific properties.

Link copied to clipboard

Creates a ChatCompletionRequest from these parameters and the provided messages.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Shortcut to fimCompletionParams, available on any existing DeepSeekParams.

Link copied to clipboard
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String