Revise existing Cypher per an instruction, without running it
const url = 'http://localhost:11044/api/v1/admin/kg/refine';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"cypher":"example","instruction":"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 http://localhost:11044/api/v1/admin/kg/refine \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "cypher": "example", "instruction": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”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.
The ask scope to use, as GET /ask/scopes lists them. Omitted means the whole graph.
Request Bodyrequired
Section titled “Request Bodyrequired”The current, possibly hand-edited Cypher in cypher and what to change about it in instruction; the revision is written within scope when one is given, validated but never run, and the response’s question echoes the instruction
Cypher to revise and what to change about it — the body of /refine.
object
The current Cypher, possibly hand-edited, that the revision starts from.
What to change, in plain language. Echoed back as the response’s question.
Example generated
{ "cypher": "example", "instruction": "example"}Responses
Section titled “Responses”The revised cypher, its verdict, and what the engine will do
Generated cypher and what the engine will do with it, without running it.
object
How many generate-validate rounds it took.
The Cypher written for the question — or, when view is set, that view’s invocation. Nothing has been executed.
Wall-clock milliseconds the call took, view matching or generation plus the explanation.
What the engine will do when this runs. Best-effort; never fails the call.
What the user typed, echoed back: the question, or for /refine the instruction.
Whether the final attempt passed the strict preflight.
Present when a saved view already answers the question: cypher is then that view’s invocation, attempts is 0, and nothing was generated. Absent when the Cypher was written for this question.
object
The arguments the selector bound from the question, by parameter name.
object
The saved view’s name, as GET /views lists it.
The selector’s one line on why this view.
What the strict preflight objected to in the final attempt, one entry per defect.
Example generated
{ "attempts": 1, "cypher": "example", "durationMs": 1, "explain": "example", "question": "example", "valid": true, "view": { "args": { "additionalProperty": "example" }, "name": "example", "reason": "example" }, "violations": [ "example" ]}No authenticated principal
A refusal carrying only a human-readable reason.
object
What went wrong, in the terms the caller can act on.
Example generated
{ "error": "example"}username names someone other than the signed-in principal
A refusal carrying only a human-readable reason.
object
What went wrong, in the terms the caller can act on.
Example generated
{ "error": "example"}Refinement failed
A refusal carrying only a human-readable reason.
object
What went wrong, in the terms the caller can act on.
Example generated
{ "error": "example"}
