fim Completion Stream
suspend fun DeepSeekClientBase.fimCompletionStream(request: FIMCompletionRequest): Flow<FIMCompletion>
Streams Fill-In-the-Middle (FIM) completions chunk by chunk from the DeepSeek API.
This function handles the low-level streaming communication with the API, allowing you to receive and process completions in real-time as they're generated.
Example:
val request = FIMCompletionRequest(
model = "deepseek-chat",
prompt = "function calculate(x, y) {",
suffix = "}",
stream = true
)
client.fimCompletionStream(request).collect { chunk ->
print(chunk.choices.firstOrNull()?.text ?: "")
}
Content copied to clipboard
Return
A Flow of FIMCompletion objects representing incremental updates
Parameters
request
The FIM completion request with streaming enabled