
Your first question
Reading the response
The response has two fields:answer: the LLM-generated answer, grounded in the retrieved passages.results: the ranked chunks used as context, in the same shape as a Search result (chunk_id,content,score,scores,source,workspace). Use these to show citations or let users open the source document.
Scoping to a subset of documents
Ask uses the same scoping rules as Search. Passworkspace_id and/or tag_id to narrow the corpus, or file_id to target specific files. file_id is mutually exclusive with workspace_id and tag_id.
max_results (default 10, range 1 to 50) controls how many passages are retrieved and fed to the model as context. More context can improve answer quality on broad questions, at the cost of latency.
Choosing a model
Two models are supported. Any other value is rejected with a422.
model | Description |
|---|---|
mistral-large-latest (default) | Mistral Large 2, flagship, best answer quality. |
alfred-ft5 | LightOn fine-tune, lighter and faster for straightforward questions. |
Streaming the answer
For chat-style UIs where you want to show the answer as it’s written, setstream: true. The response is a stream of Server-Sent Events instead of a single JSON body:
| Event | Payload |
|---|---|
sources | The retrieved chunks (same shape as results), emitted first. |
token | An incremental piece of the answer. Many of these arrive in sequence. |
done | The stream is complete. |
error | Generation failed; the stream ends. |
done event.
Common errors
| Status | Cause |
|---|---|
400 | Request body is not parsable JSON |
403 | None of the provided filters resolve to authorized resources |
422 | Validation error, e.g. unsupported model, or file_id combined with workspace_id/tag_id |
429 | Rate limit exceeded |
404 | A supported model is not currently available on the backend |
503 | Model temporarily unavailable. Retry later |
504 | Model did not respond in time. Retry later |