API tutorial runner steps#
Record and compare a local model#
python3 record.py samples/cases.json \loopback HTTP endpoint only
--endpoint http://127.0.0.1:11434/v1/chat/completions \
--model <model> --revision <rev> --hardware <hw> \
--output measured.jsonmanifest, source, labels, records
python3 cli.py measured.json --baseline samples/input.json \
--output compared.jsonrejects different dataset labels
python3 cli.py <recording> --min-accuracy <n>exit 2 below the gate
Scorecard fields#
- accuracy
- exact answer after case folding and space cleanup, over all labels.
- coverage
- predictions divided by labels.
- ece
- confidence gap per bin, weighted by bin count.
- p50_ms, p95_ms
- nearest rank latency percentiles.
- dataset_sha256
- hash of the labels. A baseline must match it.
- manifest
- needs
model, model_revision, prompt_revision, hardware and confidence_method.
Defaults and limits#
| Setting | Default | Note |
|---|
--out | web-change-output | Web brief report folder |
|---|
MaxHTMLBytes | 2_000_000 | 2 MB per page |
|---|
timeoutMs | 1500 | Per request, 1 to 30000 |
|---|
maxBytes | 65536 | Response byte limit |
|---|
| Request steps | 20 | At most per tutorial |
|---|
bins | 5 | Calibration bins |
|---|
--min-accuracy | 0 | Exit code 2 below it |
|---|
Sensitivity steps | 10 | 1 to 100 |
|---|
Error messages and fixes#
| Symptom | Cause | Fix |
|---|
chosen option must be eligible | Option has a missing value or breaks a limit | Choose a scored option |
|---|
value outside declared range | Value is not within min and max | Fix the value or the range |
|---|
Snapshots must refer to the same canonical URL | Two different URLs | Compare snapshots of one page |
|---|
Live fetch requires --baseline JSON | --fetch without a baseline | Run the saved-file mode first |
|---|
Baseline checksum mismatch | Baseline file was edited | Make a new baseline |
|---|
Network endpoint requires explicit allowNetwork | Endpoint is not loopback | Add --allow-network |
|---|
Earlier step failed; no request sent | A previous step failed | Fix the first failed step |
|---|
cannot compare different datasets | Labels differ from the baseline | Record the same cases again |
|---|
Worked examples#
- Which option wins the exhibition sample?
pods with 0.68. open has 0.67.- Why is
archive not ranked? - Its
flow value is null, so it is ineligible. - When does
open win? - In the
access sweep, at weight 0.6 or more. - Why does
read-loan fail? - It asserts the stale field
bookName. - What does the eval sample score?
- 2/3 accuracy, full coverage, p95 of 200 ms.
Tips#
- Use one filter policy for both snapshots. Filter phrases can hide changes.
- The baseline stays untouched unless you pass
--accept. - Weights are preferences, not probabilities.
- Reported confidence is model self-report. ECE changes with bins and sample count.
- The tutorial command succeeds after it writes evidence. Read the receipts.