Skip to content
getgeolens.com

Chat Stream Endpoint

POST
/ai/chat/stream/
curl --request POST \
--url https://example.com/ai/chat/stream/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "history": [ { "content": "example", "role": "user" } ], "language": "example", "layers": [ { "column_info": [ {} ], "dataset_id": "example", "dataset_table_name": "example", "dataset_title": "example", "feature_count": 1, "filter": {}, "geometry_type": "example", "id": "example", "label_config": {}, "layer_type": "example", "name": "example", "paint": {}, "sample_values": {}, "style_config": {}, "visible": true } ], "map_id": "example", "message": "example" }'

Chat-based map editing with server-sent event streaming.

Media type application/json
ChatRequest
object
history
History
Array<object>
<= 20 items
ChatHistoryMessage

A single message in the conversation history.

object
content
required
Content
string
role
required
Role
string
Allowed values: user assistant
language
Any of:
string
layers
required
Layers
Array<object>
ChatMapLayer

Layer state sent from frontend for chat context.

object
column_info
Any of:
Array<object>
object
key
additional properties
any
dataset_id
required
Dataset Id
string
dataset_table_name
required
Dataset Table Name
string
dataset_title
Any of:
string
feature_count
Any of:
integer
filter
Any of:
Array
geometry_type
Any of:
string
id
required
Id
string
label_config
Any of:
object
key
additional properties
any
layer_type
Any of:
string
name
required
Name
string
paint
Any of:
object
key
additional properties
any
sample_values
Any of:
object
key
additional properties
any
style_config
Any of:
object
key
additional properties
any
visible
Visible
boolean
default: true
map_id
required
Map Id
string
message
required
Message
string
>= 1 characters <= 2000 characters

Server-Sent Events stream

Media type text/event-stream

UTF-8 server-sent event frames. Each data field contains one JSON event payload described by x-geolens-event-schema.

string
Example
event: token
data: {"type":"token","text":"Updated "}
event: actions
data: {"type":"actions","actions":[]}
event: done
data: {"type":"done","explanation":"Updated the map"}

Bad request — invalid query parameters or payload

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Unauthorized — missing or invalid credentials

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Forbidden — caller lacks access to this resource

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Not found

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Validation error

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Too many requests — retry after the advertised interval

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}
Retry-After
integer

Seconds until the request may be retried

Internal server error

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Service unavailable — the database could not serve the request

Media type application/problem+json
ProblemDetail
object
detail
required
Any of:
string
status
required
Status
integer
title
required
Title
string
type
Type
string
default: about:blank
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}