Skip to main content
POST

Overview

Same retrieval and prompting as POST /answer, but the LLM response is streamed as Server-Sent Events (SSE) instead of a single JSON body. When no passages are retrieved, the server does not call the LLM: you get one token event with I don’t have enough information to answer that question. then done with context_count: 0. Typical event order:
  1. meta - model, sources, and context count (sent once)
  2. token - one or more answer text deltas
  3. done - full answer echo and metadata
  4. error - if the LLM call fails (instead of done)
Requires Ollama running on the host. Start the stack with moorcheh-edge up (use --skip-ollama for search-only).

Request body

Same fields as Answer (RAG):
query
string
required
Original question text (included in the LLM prompt and echoed in the response).
query_vector
array
required
JSON array of floats used for similarity search. Length must match the store dimension (768 for text stores).
top_k
number
default:"5"
Number of passages to retrieve for context. Capped at 100.
threshold
number
default:"0"
Minimum search score when kiosk_mode is true.
kiosk_mode
boolean
default:"false"
When true, filters retrieved passages below threshold.
header_prompt
string
Optional system instruction (replaces the default RAG system prompt).
Optional instruction appended before the user question in the final user message.
chat_history
array
Prior turns: [{"role": "user"|"assistant", "content": "..."}].
temperature
number
default:"0.2"
LLM sampling temperature (0.0–2.0).

SSE events

The sources array in meta matches the shape returned by POST /search (id, score, label, text).

Errors

Non-streaming HTTP errors (empty store, invalid vector, LLM not configured) return JSON with a 4xx status before SSE starts. Once streaming begins, LLM failures arrive as an SSE error event.