Skip to main content

sse_response

Function sse_response 

Source
pub fn sse_response(stream: ChatStream, model: &str) -> Response
Expand description

Convert a ChatStream into an SSE response in OpenAI streaming format

Emits:

  1. An initial chunk with role=“assistant” and empty content
  2. Content delta chunks as they arrive from the provider
  3. A final chunk with finish_reason
  4. data: [DONE] terminator