completeStream

open override fun completeStream(messages: List<AiMessage>, config: AiConfig = AiConfig()): Flow<AiChunk>(source)

Token-by-token variant of complete — so a UI can render the reply as it arrives and a Stop action actually cancels the in-flight request (cancelling the collecting coroutine tears down the underlying HTTP call) instead of leaving it running to completion in the background.

Default replays complete's result as a single AiChunk so any existing implementer keeps compiling unchanged; the three real HTTP-backed providers override this with true SSE streaming. Never throws for an ordinary provider-side failure — ends the flow with AiChunk.Failed instead, same as complete returning Result.Failure.