pip install vegaml installs the vegaml command. State in, decide()'s JSON out, ready for jq.
vegaml "I was billed twice, refund me or I cancel." \
--choice "team=Which team handles this?=billing,technical,sales" \
--boolean "churn=Does the customer threaten to leave?"Typed flags build the sheet without JSON#
| flag | shape |
|---|---|
--boolean | "id=instructions" |
--choice | "id=instructions=a,b,c" |
--score | "id=instructions=low,mid,high" |
Each flag repeats. The score's comma list is its ordered level criteria, lowest first. Note what the flags cannot express: per-option definitions for a choice. Those matter, so for anything you will run twice, use a file.
vegaml "..." --questions @questions.json
vegaml "..." --questions '{"team": {"type": "choice", "instructions": "...", "criteria": {...}}}'--questions combines with the typed flags, and a duplicate id is an error rather than a silent overwrite.
Input and output#
- The state is the positional argument.
-, or piping with no argument, reads stdin. --prettyindents. The default is one compact JSON object on one line, which is what you want in a pipeline.--modelpicks the checkpoint: nothing for the default 0.8B,4b, a Hub id, or a path.--mode,--alpha,--views,--deviceand--max-lenpass straight through todecide().
Batches#
vegaml --jsonl tickets.jsonl \
--boolean "urgent=Does this need a reply today?" > answers.jsonlEach input line is {"state": ..., "questions": {...}?}; a line without questions uses the flags'. The checkpoint loads once, before the first line, which is the entire point: a thousand states pay for one load. Output is one result object per line, in input order.
Note
Pair it with jq for a one-line report.
Because the output is one JSON object per line, counting what happened needs no script:
vegaml --jsonl tickets.jsonl --choice "team=Which team?=billing,technical,sales" \
| jq -r '.answers.team | select(.abstain == false) | .choice' \
| sort | uniq -c