Dataset Chat Stream Endpoint
const url = 'https://example.com/ai/chat/dataset/stream/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"dataset_id":"example","history":[{"content":"example","role":"user"}],"language":"example","message":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/ai/chat/dataset/stream/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "dataset_id": "example", "history": [ { "content": "example", "role": "user" } ], "language": "example", "message": "example" }'Dataset-scoped AI chat: ask questions about a single dataset’s data.
Read-only by construction — can_edit=False selects the query_data-only
tool set, and a dataset-framed system prompt replaces the map-editing one.
Reuses the whole map-chat streaming pipeline (SQL generation, sandbox
validation, RBAC table allowlist, token budgeting) with one synthetic
server-built layer.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Dataset-scoped chat: no map, no client-supplied layer state.
The server resolves ALL dataset context (table name, columns, samples) authoritatively from the DB — the client only names the dataset.
Responses
Section titled “ Responses ”Server-Sent Events stream
UTF-8 server-sent event frames. Each data field contains one JSON event payload described by x-geolens-event-schema.
Example
event: tokendata: {"type":"token","text":"Updated "}
event: actionsdata: {"type":"actions","actions":[]}
event: donedata: {"type":"done","explanation":"Updated the map"}Bad request — invalid query parameters or payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks access to this resource
Not found
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request