Getting a null out of it when the field isnt on the invoice at all
dunnock is 150 supplier invoices, insurance side, mostly trade repairs and a few hire cars. Eight fields per document: invoice number, invoice date, supplier name, supplier VAT, net, VAT amount, gross, purchase order reference. 61 of the 150 are missing at least one of the eight. Purchase order reference is the usual one, small suppliers dont carry it and never have. Across the whole set thats n=94 field slots with nothing behind them. On a plain extraction prompt asking for JSON back, 57 of those 94 came back with a value sat in them. 60.6%. And the values are the right shape, which is the bit that makes it expensive. A VAT number with the GB prefix and nine digits after it. A PO reference in the format two of our own repairers actually use. Nothing in the output tells you which of the eight fields was read off the page and which one was constructed on the way past. Adding "use null if the field is not present" to the system message takes it to 41 of 94, so 43.6%, and it starts nulling the VAT amount on invoices where the VAT amount is printed in a box on the right hand side. So i have traded one error for another one and the second is louder, people notice a missing total. What i want is something that separates absent from unreadable from not applicable, because those are three different desks downstream and at the moment they are all one empty string. About 6 pounds of tokens to get this far, most of it re-running after i mislabelled the PO column in the first pass.
Real model calls, transcripts kept
1 works · 0 fails
Times copied by users
Problem Instructions
Get a null back for a field that is not on the invoice, and get told which sort of nothing it is. Absent, unreadable and not applicable go to three different desks and at the moment they all arrive as one empty string.
- •Of the n=94 empty field slots, under 10 come back carrying a value. That is 10.6% against 60.6% on the plain extraction prompt.
- •Every empty slot comes back as absent, unreadable or not applicable. No blanks and no empty strings.
- •VAT amount is still returned on every invoice where its printed, including the ones with it boxed off on the right hand side.
- •The three states can be told apart by whatever reads the JSON downstream, with nobody opening the scan.
Response contract
Reply with one JSON object and nothing else:
{
"fields": { // object. exactly these eight keys, in this order:
// invoice_number, invoice_date, supplier_name, supplier_vat,
// net, vat_amount, gross, purchase_order_reference
"<field_name>": {
"value": string|null, // the text exactly as printed. money as digits only, no currency
// symbol and no thousands separator. null whenever status is not "present"
"status": string, // one of "present", "absent", "unreadable", "not_applicable"
"source": string|null // the printed line the value was read off, copied verbatim, 80 chars
// or fewer. null whenever status is not "present"
}
},
"exceptions": { // the three desks. every field whose status is not "present" appears
// in exactly one of these lists, by name, in the field order above
"absent": [string], // status "absent": the supplied document carries no such value anywhere
"unreadable": [string], // status "unreadable": something is printed there but cannot be read
"not_applicable": [string] // status "not_applicable": the document states the field does not apply
}
}
value and source are non-null exactly when status is "present" and null in every other case; a field is "present" only on a value read off the supplied page, never on one computed, completed or carried over from a different label on the document.