Skip to content

Ask a question grounded in a lens's focused entities

POST
/api/v1/lenses/chat
curl --request POST \
--url http://localhost:11044/api/v1/lenses/chat \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "conversationId": "example", "english": "example", "lensId": "example", "question": "example", "script": "example" }'
username
string

Optional, and never needed: the call always acts as the signed-in principal. Naming the principal changes nothing; naming anyone else is refused with 403.

question is answered from the lens’s focused entities. The lens comes from lensId (a saved, world or realm lens id, or a saved view name) when it is non-blank and resolves, else from script (a CypherScript, run without saving), else is generated from english. Omit conversationId on the first turn and send back the returned one to continue the same conversation

Media typeapplication/json

A question to answer grounded in a lens’s focused entities; sent to POST /lenses/chat. The lens comes from lensId, else script, else is generated from english.

object
conversationId

Conversation to continue. Omit or leave blank on the first turn and the server starts one, answering its id as conversationId; pass that back on later turns.

string
english

Plain-English description the server generates a CypherScript lens from; used only when neither lensId nor script gives the lens

string
lensId

Id of a saved or world lens to open, e.g. briefing. When it is blank or names no lens, the lens is taken from script or english instead.

string
question
required

The question, answered by the main chat with the lens’s focused entities added to the caller’s working state

string
script

Ready CypherScript program to open as the lens; used when lensId gives none, and preferred over english

string

Example generated

{
"conversationId": "example",
"english": "example",
"lensId": "example",
"question": "example",
"script": "example"
}

OK

Media typeapplication/json
object

Example generated

{}

No authenticated principal

Media typeapplication/json

A refusal carrying only a human-readable reason.

object
error
required

What went wrong, in the terms the caller can act on.

string

Example generated

{
"error": "example"
}

username names someone other than the signed-in principal

Media typeapplication/json

A refusal carrying only a human-readable reason.

object
error
required

What went wrong, in the terms the caller can act on.

string

Example generated

{
"error": "example"
}