Generate (or, with `current`, refine) a TypeScript handler from English, with the tsc verdict
const url = 'http://localhost:11044/api/v1/admin/handlers/generate';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"current":"example","english":"example","skills":["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/handlers/generate \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "current": "example", "english": "example", "skills": [ "example" ] }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”english describes the handler to write; when current is given, english is instead a change to make to that source. skills names skills handed to the writing model as references, prompt and tools both. Nothing is saved: the answer is the source with its tsc verdict
An English description of a handler, optionally as a change to existing source.
object
When present, english is a CHANGE to this source — the round-trip an editor’s Refine drives.
What the handler should do, in English; with current, the change to make to that source.
Skills to bundle. They are handed to the writing model as references — prompt contribution AND tools — so a realm’s documented idioms are followed rather than re-derived.
Example generated
{ "current": "example", "english": "example", "skills": [ "example" ]}Responses
Section titled “Responses”The generated source and whether it type-checks
Generated (or refined) handler source, with the tsc verdict on it.
object
1, or 2 when the model was handed its own type errors to fix.
Server-side time the generation took, attempts included, in milliseconds.
Always true; valid carries the verdict.
The generated TypeScript handler body. Nothing is saved.
Whether source passes the same tsc gate save enforces.
The compiler’s errors, in the SOURCE’s own line coordinates. Empty when valid.
Example generated
{ "attempts": 1, "durationMs": 1, "ok": true, "source": "example", "valid": true, "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"}
