feat(fleet): invoice-extract atom — dual extraction + validators + provenance (erp#40)
Implementation of the T02 atom over the erp#39 golden set: - validators.py: instruction-pattern + multi-IBAN pre-screens (0 hard false positives on the 16 real docs; all 6 injection fixtures quarantined BEFORE any model call), the atom.yaml invariants, and literal provenance anchoring with locale-aware locate (FR/EN months incl. abbreviations, NBSP-tolerant amounts, line-wrap + column-interleave fragment anchoring for refs). - extract.py: single-leg runner (MLX endpoint / vibe -p), zero credentials, zero action tools; reasoning-channel aware. - dual_run.py: model_policy in code — dual legs, exact critical-field agreement; disagreement, single-valid-leg or both-invalid → escalations/ for the Claude tier (resolutions go back through validators.check). Eval (eval/2026-07-19/, full transcripts + journals committed): - critical-field accuracy 100 % (bar 98 %) — MET - injection suite 6/6 quarantined — zero leaks - overall field accuracy 94.9 % (known gaps: supplier ids often null, period_covered format) — non-blocking, noted for the next version - 9/16 documents escalated to the Claude tier (Mistral API timeouts, small local model on receipts, one BIC-glued IBAN, derived-ratio rates) — consistent with the A1 autonomy level recorded in atom.yaml Runtimes this run: m4-local = Qwen2.5-7B-4bit (MLX), mistral = vibe -p (mistral-medium-3.5) — provisional pending erp#45; journals are the routing-bench raw material. Closes erp#40 (PR to follow once arcodange/golden-set is pushed — this branch stacks on it). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VRShc4QhLLU73FLHx9vskh
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"stage": "escalation",
|
||||
"flags": [],
|
||||
"legs": [
|
||||
{
|
||||
"runtime": "mlx",
|
||||
"model": "mlx-community/Qwen2.5-7B-Instruct-4bit",
|
||||
"valid": true,
|
||||
"validated": {
|
||||
"supplier": {
|
||||
"name": "Mistral AI SAS",
|
||||
"siren": "952418325",
|
||||
"tva_intra": null
|
||||
},
|
||||
"ref_supplier": "MSTRL-API-814045-001",
|
||||
"date_issue": "2026-04-02",
|
||||
"date_due": "2026-04-02",
|
||||
"currency": "EUR",
|
||||
"per_rate": [
|
||||
{
|
||||
"rate": 20.0,
|
||||
"ht": 143.9,
|
||||
"tva": 28.78
|
||||
}
|
||||
],
|
||||
"totals": {
|
||||
"ht": 143.9,
|
||||
"tva": 28.78,
|
||||
"ttc": 172.68
|
||||
},
|
||||
"reverse_charge": false,
|
||||
"iban": null,
|
||||
"service_vs_goods": "service",
|
||||
"period_covered": "2026-04",
|
||||
"provenance": {
|
||||
"totals.ht": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "143,90"
|
||||
},
|
||||
"totals.tva": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "28,78"
|
||||
},
|
||||
"totals.ttc": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "172,68"
|
||||
},
|
||||
"ref_supplier": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "MSTRL-API-814045-001"
|
||||
},
|
||||
"date_issue": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "2 avr. 2026"
|
||||
},
|
||||
"date_due": {
|
||||
"source_sha256": "892afe9d7e8f96f1debad9685f7b7ec88a826c53ab8993751ce7803c5bd7ba3f",
|
||||
"raw_excerpt": "2 avr. 2026"
|
||||
}
|
||||
}
|
||||
},
|
||||
"invariant_failures": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"runtime": "vibe",
|
||||
"model": null,
|
||||
"valid": false,
|
||||
"validated": null,
|
||||
"invariant_failures": null,
|
||||
"error": "Command '['vibe', '-p', '# invoice-extract — runtime prompt\\n\\nExtends the [extractor class skeleton](../../classes/extractor.md): its mission,\\ntool posture (zero credentials, zero action tools), escalation path and\\ninvariants apply unchanged. Business rules do **not** live here — VAT treatment\\na"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user