Skip to main content

HTTP client - answer_stream()

MoorchehEdgeApiClient.answer_stream() calls POST /answer/stream and yields raw response bytes (SSE chunks). Use this when you need token-by-token output; for a one-shot answer, use answer_text() or answer() instead. The high-level MoorchehEdge SDK does not wrap streaming yet - use MoorchehEdgeApiClient directly.
Parse SSE events from the byte stream, or use the internal _sse.iter_sse_events helper if you build tooling inside the package.

Optional prompts and history

Same optional fields as answer_text():

SSE events

See API: Answer stream for the meta, token, done, and error event shapes. When no passages are retrieved, you get one token event with I don’t have enough information to answer that question. then done with context_count: 0 - the LLM is not called.

Requirements

  • Store must contain uploaded documents (text or vector mode).
  • Ollama must be running with qwen2.5:0.5b-instruct (use moorcheh-edge up --with-llm on Linux).