.lmai — Prompt Orchestration | LMX

LMX // .LMAI

.lmaiPrompt Orchestration

Declare prompts and shapes, ASK a model, branch on the answer.

  • Needs an install
  • a .lmai file
  • free to run
WHAT IT IS

Why .lmai exists.

A prompt-orchestration language over the one provider seam every Leumas engine shares. Declare PROMPT templates with {{slots}}, force JSON with SHAPE + AS, branch with WHEN, and read the accounting with USAGE. Keys resolve exactly as they do for chatbots and the coding agent — a member uses the mounted key, a free user brings their own, and neither means a clear refusal. Every run reports WHICH provider answered: auto always resolves to something, including a built-in echo stub, so a reply alone never proves a model ran.

Needs an install

Its vocabulary is a RUNNING Leumas install — your collections, your tools, your models. That is why it cannot run anonymously: with no account there is nobody for it to act as.


A WORKED EXAMPLE

Classify a support message, then follow up when the model is unsure

Takes inputs — Named inputs become {{slots}}: pass an object like { "input": "my card was declined twice" }..

# Classify a support message, then follow up when the model is unsure
# inputs: input=my card was declined twice this morning
MODEL auto
TEMPERATURE 0.2
SYSTEM "You are a terse support classifier. Answer with JSON only."

PROMPT classify = "Label this support message as billing, bug or other:\n{{input}}"
SHAPE verdict = { "label": "billing", "confidence": 0.9 }

ASK classify -> r AS verdict
PRINT "label: {{r.label}} (confidence {{r.confidence}})"

WHEN r.confidence < 0.7 THEN ASK "In one sentence, why is this message ambiguous?\n{{input}}" -> why
PRINT why

USAGE
RETURN r

1 more example

Route an inbound message to a queue, with a confidence gate and a fallback
# Route an inbound message to a queue, with a confidence gate and a fallback
# inputs: input=the export button does nothing on Safari
MODEL auto
TEMPERATURE 0
MAXTOKENS 400
SYSTEM do
  You triage inbound support messages for a software product.
  Be decisive. Answer with JSON only, no prose and no code fences.
end

SET fallback = "human-review"

PROMPT route do
  Route this message to exactly one queue: billing, bug, feature, other.
  Give a confidence between 0 and 1, and one short reason.

  Message:
  {{input}}
end

SHAPE routing = { "queue": "bug", "confidence": 0.82, "reason": "reports broken UI behaviour" }

ASK route -> r AS routing
PRINT "queue: {{r.queue}}  confidence: {{r.confidence}}"
PRINT "reason: {{r.reason}}"

WHEN r.confidence < 0.6 THEN PRINT "below threshold — sending to {{fallback}}"

USAGE
RETURN r

SYNTAX

The shape of it.

Straight from the interpreter catalogue — the same summary the editor shows as a placeholder.

MODEL auto
SYSTEM "You are a terse support classifier."

PROMPT classify = "Label this as billing, bug or other:\n{{input}}"
SHAPE verdict = { "label": "billing", "confidence": 0.9 }

ASK classify -> r AS verdict
PRINT r.label
USAGE
RETURN r

NEXT

Where to take it.

Or run it against an install you already have: the CLI takes --studio <url> --token <t>.