answer.generate
Generate AI-powered answers with RAG (retrieve from a text namespace) or direct LLM calls. Configure the LLM provider (Ollama, OpenAI, or Cohere) withmoorcheh configure before use.
POST /answer — see Generate AI Answer
Search Mode (RAG)
Direct AI Mode
Use an empty namespace string:With chat history
Structured output
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | User question |
namespace | string | Yes | Text namespace for RAG, or "" for direct LLM |
top_k | number | No | Chunks to retrieve (default 10) |
temperature | number | No | 0.0–2.0 (default 0.7) |
ai_model | string | No | Override configured LLM model |
chat_history | array | No | Prior turns |
header_prompt | string | No | System instruction |
footer_prompt | string | No | Trailing instruction |
kiosk_mode | boolean | No | Filter by threshold |
threshold | number | No | Required if kiosk_mode is true |
structured_response | object | No | { "enabled": true, "schema": {...} } |
Response
| Field | Type | Description |
|---|---|---|
answer | string | Generated text |
model | string | Model ID used |
context_count | number | Chunks used for RAG |
query | string | Echo of input query |
structured_data | object | When structured output is enabled |