FIMCompletionParams

Parameters for configuring Fill-in-the-Middle (FIM) completion requests to DeepSeek models.

FIM allows the model to complete text where you provide both a prefix and a suffix, making it useful for code completion, text infilling, and template-based generation.

Example:

val params = fimCompletionParams {
temperature = 0.7
maxTokens = 200
suffix = "}" // The code should end with a closing bracket
}

val completion = client.fim(params, "function calculateArea(radius) {")
println(completion.choices.first().text)

Types

Link copied to clipboard
class Builder

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

Link copied to clipboard

Builder for creating FIMCompletionParams specifically configured for streaming responses.

Properties

Link copied to clipboard

Whether to include the prompt in the returned completion. Cannot be combined with suffix or logprobs — the API answers 400 echo should not be used with suffix / echo should not be used with logprobs

Link copied to clipboard

Sent as frequency_penalty, ignored by the API.

Link copied to clipboard

Maximum number of log probabilities to return (up to 20)

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. The reference documents only ChatModel.DEEPSEEK_V4_PRO, which is the default, but the endpoint also serves ChatModel.DEEPSEEK_FLASH

Link copied to clipboard

Sent as presence_penalty, ignored by the API.

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

Text that the model should complete towards (the ending part in FIM)

Link copied to clipboard

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

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.

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, echo: Boolean? = this.echo, frequencyPenalty: Double? = this.frequencyPenalty, logprobs: Int? = this.logprobs, maxTokens: Int? = this.maxTokens, presencePenalty: Double? = this.presencePenalty, stop: StopReason? = this.stop, stream: Boolean? = this.stream, streamOptions: StreamOptions? = this.streamOptions, suffix: String? = this.suffix, temperature: Double? = this.temperature, topP: Double? = this.topP): FIMCompletionParams

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

Link copied to clipboard

Creates a FIMCompletionRequest from these parameters and the provided prompt.

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