Grounded Chat
Creates a grounded chat session over collections, or asks an existing session a question.#
/lmkit/v1/search/chatMulti-turn grounded chat: every turn retrieves supporting sources from the session's collections, answers bound to them with citations (like the answer endpoint), and the conversation keeps its full dialogue state on the server, so follow-up questions work naturally; a follow-up is contextually rewritten for retrieval by default when the tenant has a query model. Without 'session_id' the call creates a session (scope, model, and per-turn retrieval/grounding defaults are fixed at creation) and returns its id; with 'session_id' it runs one turn, optionally streamed as Server-Sent Events. Sessions are held server-side, expire after idling, and die with the process; idle session state is tiered out of device memory transparently, so long-lived sessions are cheap.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
session_id | string | The session to continue. Omit to create a new session. |
question | string | The question for this turn. Required with 'session_id'; ignored at session creation. |
stream | boolean | Continuation only: when true, the turn streams as Server-Sent Events like the answer endpoint, with 'session_id' on every frame. |
cluster_id | string | Creation: the search cluster that holds the tenant and collections. Defaults to the default cluster. |
tenant_id | string (uuid) | Creation: the tenant that owns the collections. |
collection_id | string (uuid) | Creation: a single collection to chat over. Ignored when 'collection_ids' is provided. |
collection_ids | string (uuid)[] | Creation: the collections this session answers from. Takes precedence over 'collection_id'. |
model | string | Creation: the chat model for the session. Empty uses the server's default chat model. |
grounding | Creation: how strictly answers bind to the sources, as on the answer endpoint. Fixed for the session's lifetime. Defaults to 'Strict'. | |
prompt_template | string | Creation: optional custom per-turn prompt template with '@context' and '@question', as on the answer endpoint. |
search_type | Creation: how each turn retrieves, as on the answer endpoint (Hybrid degrades to the tenant's enabled modes). Defaults to 'Hybrid'. | |
top_k | object (int32) | Creation: sources retrieved per turn (1..20). Defaults to 5. |
filters | object | Creation: optional metadata filter (equality map) applied to every turn's retrieval. Mutually exclusive with 'filter'. |
filter | one of object · | |
min_score | object (double) | Creation: relevance floor for retrieved sources. Defaults to 0. |
rerank | boolean | Creation: rerank each turn's retrieved sources, as on the search endpoint. |
rerank_top_n | object (int32) | |
rerank_alpha | object (double) | |
context_expansion | Creation: how much surrounding content each source contributes, as on the answer endpoint. Defaults to 'Chunk'. | |
max_chunks_per_document | object (int32) | Creation: maximum sources drawn from one document per turn (1..10). Defaults to 3. |
max_completion_tokens | object (int32) | Creation: maximum tokens each turn may generate. Defaults to 1024. |
temperature | object (double) | Creation: sampling temperature for the session. 0 (default) decodes greedily. |
max_context_characters | object (int32) | Creation: character budget for each turn's source blocks. Defaults to 24000. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 400 | Bad Request | |
| 404 | Not Found | |
| 429 | Too Many Requests | |
| 503 | application/json | Service Unavailable |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/search/chat" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "string",
"question": "string",
"stream": false,
"cluster_id": "string"
}'Skips the current reasoning phase of a session's in-flight turn.#
/lmkit/v1/search/chat/{sessionId}/skip-thinkingParameters
| Name | In | Type | Description |
|---|---|---|---|
sessionIdrequired | path | string |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 404 | Not Found |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/search/chat/$SESSIONID/skip-thinking" \
-H "Authorization: Bearer $LMKIT_API_KEY"Clears a session's conversation history, keeping the session and its scope.#
/lmkit/v1/search/chat/{sessionId}/clear-historyParameters
| Name | In | Type | Description |
|---|---|---|---|
sessionIdrequired | path | string |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 404 | Not Found |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/search/chat/$SESSIONID/clear-history" \
-H "Authorization: Bearer $LMKIT_API_KEY"Deletes a grounded chat session.#
/lmkit/v1/search/chat/{sessionId}Parameters
| Name | In | Type | Description |
|---|---|---|---|
sessionIdrequired | path | string |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 404 | Not Found |
curl -X DELETE "$LMKIT_ONE_URL/lmkit/v1/search/chat/$SESSIONID" \
-H "Authorization: Bearer $LMKIT_API_KEY"