ProblemsSchema passes and the value is still wrong, so what does the retry key on

Schema passes and the value is still wrong, so what does the retry key on

Asked by hollisc·
devretriesjsonintermediate

We take about 40k inbound faxes a day and the extraction step hands back JSON. The envelope is fine these days, thats not what this is about. What I have is a retry that fires on a parse failure or a schema violation, and there isn't anything else for it to fire on. Two from last week. `refills_remaining` came back 3 and the fax says 0. Valid integer, inside the allowed range, record written, nobody sees it until a pharmacist rings the branch. The other one had `qty` at 30 where the sig works out to 90 over the period. Both of those documents came back clean. The retry never woke up. From where it sits there was nothing to wake up for. Things I've tried. Run the call twice and compare. Doubles the spend, and I still need a tiebreak when the two disagree, which was 21 of 300 on a sample I pulled on the 3rd. On some of the 21 both readings were wrong and agreed with each other anyway. Ask for a confidence number. every value comes back 0.9 something. they don't move when it's wrong. i went through about forty by hand and stopped. ask it to quote the line it took the value off. this is the one i think has legs, but the quote gets generated the same way the value does, so it can hand me a line that isnt on the page and i would not know from here. what im after is a field in the output a caller can check on its own, without a person opening the fax. not a better model. something the retry can key on. happy to pay for a second call if the second call is doing something different to the first. extraction batch runs 04:00 to 06:30 and there's about a 40 minute window to re-run anything before the courier manifests go out.

3 Prompt Submissions
Executed Calls

Not run against a model yet

Works Rate

0 works · 0 fails

Total Copies
0

Times copied by users

Problem Instructions

Something in the output a caller can check on its own, so the retry has a reason to fire when the JSON is valid and the value is still wrong. A schema pass says nothing about refills_remaining coming back 3 where the fax reads 0.

  • The check runs without a person opening the fax.
  • Anything the model quotes can be matched back against the text we already hold, so a line that is not on the page fails it.
  • it fires on both of last week's. refills_remaining 3 against a fax reading 0, and qty 30 where the sig works out to 90.

Response contract

Reply with one JSON object and nothing else. No markdown fence, no preamble, no text after the closing brace.

{
  "fields": [                          // one entry per requested field, in the order the field list gives them; never omitted, never merged
    {
      "name": "policy_number",         // the requested field name, copied exactly from the field list
      "value": "44-B",                 // the value in the type the field list asks for; null whenever status is ABSENT, ILLEGIBLE or CONTRADICTED
      "quote": "Policy no. 44-B",      // one whole line of the document, copied character for character with only the leading and trailing spaces dropped; null when status is ABSENT or ILLEGIBLE
      "second_quote": null,            // the one other line that disagrees with quote; null for every status except CONTRADICTED
      "status": "LITERAL"              // LITERAL | DERIVED | ABSENT | ILLEGIBLE | CONTRADICTED
    }
  ],
  "needs_review": ["premium_due"]      // names of every field whose status is CONTRADICTED or ILLEGIBLE, in field order; [] when none. This is the only key the retry reads.
}

STATUS

LITERAL       the characters of the value already stand inside quote in the form the field list asks for. Only a change of letter case and the dropping of surrounding whitespace are allowed.
DERIVED       the value follows from quote by an operation you can name: a number written in words turned into digits, a thousands comma or a currency symbol dropped, a unit converted, a date reordered, two numbers on the line combined.
ABSENT        the document is legible where this field would be stated and does not state it. A normal reading, not a failure, and not a reason to retry.
ILLEGIBLE     the place where the field would be stated is on the page but cannot be read: struck through, stamped over, cut off at the edge, or rendered as scanner noise.
CONTRADICTED  the document supports two different values for this field: two lines that state it and disagree, or one line that states it and another line that implies a different value.

WHICH LINE GOES IN QUOTE

One line states the field: that line.
Two lines state it and they agree: the earlier of the two, and second_quote stays null.
Two lines state it and they disagree: quote is the earlier, second_quote is the later.
One line states it and another implies a conflicting value: quote is the line that states it, second_quote is the line that carries the conflict.

RULES

quote and second_quote are matched back against the document by exact substring. A line you tidied, re-spaced, joined across a break or rebuilt from memory fails that match, and a record whose quote fails the match is discarded whatever its value says.
A number written in words, or carrying a thousands comma or a currency symbol, where the field list asks for a number, is DERIVED. It is never LITERAL.
CONTRADICTED carries null in value. Do not pick the reading that looks more plausible and do not average the two.
Two lines that state one value in two notations agree. Agreement is not a contradiction.
Do not fill a field from a neighbouring field whose name or whose shape of value looks close. A field the document does not state is ABSENT.
needs_review holds exactly the CONTRADICTED and ILLEGIBLE names. Not ABSENT, not DERIVED, and never a field you merely found hard.
No keys beyond the five per field and needs_review. No confidence number anywhere.

🏆 Best Current Solution

Marcelo Diniz has the most upvoted solution, at 1.

0% Worked·0 Forks

Prompt Submissions(3)

Loading...