Chat Endpoint
POST
/ai/chat/
const url = 'https://example.com/api/ai/chat/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"message":"example","map_id":"example","layers":[{"id":"example","name":"example","dataset_id":"example","dataset_table_name":"example","geometry_type":"example","layer_type":"example","column_info":[{}],"dataset_title":"example","feature_count":1,"sample_values":{},"visible":true,"filter":{},"label_config":{},"style_config":{},"paint":{}}],"language":"example","history":[{"role":"user","content":"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/api/ai/chat/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "message": "example", "map_id": "example", "layers": [ { "id": "example", "name": "example", "dataset_id": "example", "dataset_table_name": "example", "geometry_type": "example", "layer_type": "example", "column_info": [ {} ], "dataset_title": "example", "feature_count": 1, "sample_values": {}, "visible": true, "filter": {}, "label_config": {}, "style_config": {}, "paint": {} } ], "language": "example", "history": [ { "role": "user", "content": "example" } ] }'Chat-based map editing: send a message and get back edit actions.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
ChatRequest
object
message
required
Message
string
map_id
required
Map Id
string
layers
required
Layers
Array<object>
ChatMapLayerLayer state sent from frontend for chat context.
object
id
required
Id
string
name
required
Name
string
dataset_id
required
Dataset Id
string
dataset_table_name
required
Dataset Table Name
string
column_info
Any of:
Array<object>
object
key
additional properties
any
null
visible
Visible
boolean
history
History
Array<object>
ChatHistoryMessageA single message in the conversation history.
object
role
required
Role
string
content
required
Content
string
Responses
Section titled “ Responses ”Successful Response
Media type application/json
ChatResponse
object
explanation
required
Explanation
string
actions
required
Actions
Array<object>
ChatActionobject
type
required
Type
string
geojson
Any of:
GeoJSONFeatureCollection
A GeoJSON FeatureCollection.
object
type
Type
string
features
Features
Array<object>
GeoJSONFeatureA single GeoJSON Feature.
object
type
Type
string
id
required
Id
integer
geometry
Any of:
GeoJSONGeometry
A GeoJSON geometry object (RFC 7946).
object
type
required
Type
string
coordinates
required
Coordinates
Array
null
properties
required
Properties
object
key
additional properties
any
key
additional properties
any
null
bbox
Any of:
Array<number>
null
Example
{ "actions": [ { "type": "set_filter", "geojson": { "type": "FeatureCollection", "features": [] } } ]}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}