Skip to content

Schema object

A schema is a JSON object. Each key is a field name that will appear in result; each value is a field spec. Field names should be valid identifiers (letters, digits, _), because rules and formulas refer to them.

{
  "merchant": {"type": "string", "extract": true, "instruction": "Store name"},
  "total":    "number",
  "category": {"enum": ["food", "transport", "other"]}
}

A spec can be a short string ("string", "number", "bool") or an object.

Types at a glance

Type Produced by Value Constrained while generated
string model text no (free text), or verbatim copy with extract
number model number yes: digits, sign, decimal point
bool model true / false yes
enum model one listed value yes
list model array of strings, numbers, booleans or enum values yes for typed items
compute code number –
call code (HTTP) any JSON –

Options for every model field

These apply to string, number, bool, enum and list.

Option Type Default Description
instruction string – What the field means. Alias: description.
nullable boolean false Allow null when the value is not in the input.
depends_on array of names [] Fill after these fields and see their values. See Multi-step schemas.
on array of rules [] Checks run in code after the field is filled.
on_reject any null Value used if the request is rejected before or while this field is filled.
votes integer 1–5 1 Fill several times with different wordings; majority wins. Not for free_form.
vote_instructions array of strings – Your own alternative wordings for voting (sets votes if omitted).

string

{"type": "string", "instruction": "Customer name", "extract": true, "nullable": true}
Option Default Description
extract false The value must be a verbatim part of the input (context and messages). The model cannot invent or re-spell. Text only (not images, not list items).
free_form false Long text: reasoning, summaries, replies. Has no confidence. Cannot be combined with extract, votes or confidence rules.

Returns text, trimmed. With extract, formatting is kept as written (3201-4567 keeps its hyphen).

number

{"type": "number", "integer": true, "max_digits": 10, "instruction": "Total in rupiah"}
Option Default Description
integer false Whole numbers only; returned as an integer. Also set by "type": "integer".
max_digits 8 Maximum characters, including - and .. 12345678 fits, 123456789 does not. Money fields often need 10–12.

Output has no thousands separators. Returns a number, or null if the answer was cut off.

bool

{"type": "bool", "instruction": "Was the invoice paid?"}

Returns true or false (null only if nullable or cut off). Alias: "boolean".

enum

{"enum": ["inpatient", "outpatient", "other", null], "instruction": "Claim type"}
  • Up to 24 values. Values may be strings or numbers.
  • Put null in the list to allow no answer (or set nullable: true).
  • The instruction automatically lists the allowed values.

list

{"type": "list", "items": {"type": "number", "integer": true, "max_digits": 3},
 "max_items": 5, "instruction": "HTTP error codes in the log"}
Option Default Description
items "string" Spec of each item: string, number, bool or enum. Not lists, objects, compute or call.
max_items 20 Maximum number of items.

The model writes one item per line; typed items are constrained, string items have bullets and numbering removed. Returns an array, possibly empty. Put on and depends_on on the list field, not on items. Alias: "array".

compute

{"type": "compute", "expr": "total_installment / net_salary * 100", "round": 2,
 "on": [{"when": {"gt": 40}, "do": "review"}]}
Option Default Description
expr required Formula over other fields: names, numbers, + - * /, parentheses, abs(x), min(a, b, …), max(a, b, …), round(x).
round – 0 → integer; 1–10 → decimals; omitted → full precision.
on, on_reject, depends_on – As above. Fields in expr are added to depends_on automatically.

Returns a number, or null if an input is missing or not a number, or on division by zero. Not allowed: nullable, extract, votes, free_form. See Computed fields.

call

{"type": "call",
 "http": {"method": "GET", "url": "https://api.example.com/policy/{id}",
          "headers": {"Authorization": "Bearer {{secret.token}}"},
          "timeout": 10, "response": {"select": "data", "not_found": [404]}},
 "args": {"id": "$policy_number"},
 "expose": ["name", "status"],
 "on_error": "review"}
Option Default Description
http.method GET GET, POST, PUT, PATCH, DELETE, HEAD.
http.url required Absolute http(s) URL; the host must be literal.
http.query {} Query parameters.
http.headers {} Request headers.
http.body – JSON body (not for GET/HEAD).
http.timeout 10 Seconds (max 60).
http.retry – {"attempts": 1-3}; GET/HEAD only unless "unsafe": true.
http.response.select whole body Path (data.items[*].name) or {name: path}.
http.response.not_found [] Statuses that mean "not found" → null instead of an error.
args {} Values for {name} placeholders: "$field", "$field.path" or constants. $ references become dependencies.
expose nothing What later prompts see: list of keys, or true for everything.
on_error "null" null, review or reject when the call fails.
on, on_reject – As above; use at in rules to check keys of the result.

See Tool calls for placeholders, secrets and security.

Type aliases

You write Means
"boolean" bool
"integer", "int" number with integer: true
"float" number
"str" string
"array" list
{"type": ["number", "null"]} number with nullable: true