Spaces:
Sleeping
Sleeping
Commit History
-
rename package doc_agent -> docfield, distribution -> docfield-extract
The last identifier still carrying the old framing. The project is not an agent and the README says so; the import path said otherwise on every line of every module. Moved with git mv so history follows all 26 files, and kept as a package directory rather than flattened -- removing it would break the src layout the Space entry point depends on. pyproject needs [tool.uv.build-backend] module-name = "docfield". The uv build backend derives the module name from the project name, so a distribution called docfield-extract would otherwise look for src/docfield_extract/ and fail to find the package. Distribution name and import name differ on purpose: docfield-extract matches the repo, docfield is what you type. DB_PATH default moves from ./data/agent.db to ./data/docfield.db. This orphans any existing local database -- a watcher run against the new default starts an empty store and the old file is simply ignored, not migrated. There was no .db file in this working tree, so nothing was act…b6beb2d
-
validation: monetary tolerance scales with rounded terms, not with value
H2 and H3 gate auto-acceptance, and their tolerance was max(0.02, 0.005 * amount) -- 0.5% of the document value. That is the same defect the README records fixing on the measurement side, still live on the decision side, where the consequence is a wrong total being written rather than a metric being off. At 500 it permitted a 2.50 discrepancy; at 100,000 it permitted 500. It is also mis-specified against its own stated intent. The old comment said large invoices should "tolerate the accumulated rounding of many line items", which is a fair thing to want, but rounding accumulates with the *number* of figures summed, not their magnitude. A 100,000 invoice with two lines has no more rounding in it than a 100 one. Replace the relative term with a count-based one: 0.02 plus half a cent per additional independently-rounded quantity. H2 compares three stated figures and takes the floor alone. H3 allows per line item summed. S4 allows per unit, since a unit price rounded to the cent carries …6eb59bb
-
docs: correct stale money-comparison docstring in eval.normalize
values_match compares money cent-exact (round to 2dp, no relative tolerance); the docstring still said 'within the rounding tolerance'. Comment only.a1aecdd
-
phase 5: evaluation harness (SROIE)
Two-phase harness so inference runs exactly once and tuning is free: - predict phase (eval/predict.py): runs process_document over a dataset slice, saves PIL images to temp files, caches gold + predicted Document + confidence + validation report to eval/cache/ keyed by id. The only phase that hits the model; idempotent (cached ids skipped) so re-runs never re-bill. - score phase (eval/score.py + eval/metrics.py): loads the cache and computes per-field and per-critical-field precision/recall/F1, the auto-accept critical precision, and a threshold sweep (0.50-0.99) that replays the real route() over cached (confidence, report), honoring the hard-failure override. Fully offline. Datasets: SROIE (jsdnrs/ICDAR2019-SROIE test) wired end-to-end; CORD and an invoice-JSON set scaffolded as adapters but not wired (load() raises, absent from WIRED_DATASETS). Only dataset-labeled fields are scored. Comparison (eval/normalize.py) reuses the schema's number/date coercion, then compares…d2a6765