fim Completion Stream Params
fun fimCompletionStreamParams(block: FIMCompletionParams.StreamBuilder.() -> Unit): FIMCompletionParams
Creates streaming FIM completion parameters using a builder pattern.
This function provides a convenient way to configure streaming FIM completion parameters using Kotlin's DSL-style builder syntax. The resulting parameters will have stream
set to true
automatically.
Streaming is particularly useful for long completions, allowing you to process and display results incrementally as they arrive.
Example:
val streamParams = fimCompletionStreamParams {
temperature = 0.7
streamOptions = StreamOptions(chunkSize = 10)
suffix = "}"
}
client.fimStream("function calculate() {", streamParams).collect { chunk ->
print(chunk.choices.firstOrNull()?.text ?: "")
}
Content copied to clipboard
Return
Configured FIMCompletionParams instance with streaming enabled
Parameters
block
Configuration block for setting parameter values