Three scripts and a matching test suite that let you experimentally
compare a fine-tuned model against the production gpt-5-nano baseline
on the same 10-record smoke eval.
* scripts/prep_ft_dataset.py — reads receipt/invoice JSONL and produces
OpenAI chat-completions fine-tuning format. System prompt matches
production (get_prompt(doc_type)); user shape matches
DocumentExtractor._build_messages; assistant carries the envelope
(data + field_confidences + warnings) with the ground truth as data.
Accepts multiple --input files (concatenated). --val-frac=0 skips the
validation split entirely for tiny datasets.
* scripts/launch_finetune.py — uploads train + val files via
files.create(purpose='fine-tune'), kicks off
fine_tuning.jobs.create() on gpt-4o-mini-2024-07-18 by default,
polls status every 30s. Ctrl-C detaches cleanly.
* scripts/compare_finetune.py — runs the 5-SROIE + 5-CORD smoke eval
against both the base model and the fine-tuned model, emits
comparison.md…