Library / Documents, PDF & OCR
Documents, PDF & OCR
Verify contract extraction and flag hallucinated fields with Judgment API
When you run it, it reads and extracts data from documents using Judgment.
What it does
## Verify extracted contract terms and flag the fabricated ones with Judgment ### How it works 1. Builds two worked examples of the same contract extraction: one Set node with values that match the document, and one with two fields changed. 2. Merges them into a single stream, so both records are verified side by side. 3. Checks every extracted value against the source in one judgment call, asking two questions per field: is this value absent from the document, and does the document state a different one. 4. Reshapes the answers into a field name, a check name, the extracted value, a probability, and a verdict. 5. Sends any field the verifier doubted through *Explain the Flag* to the *Review Queue*, and treats the rest as confirmed. ### Setup steps - [ ] Add your Judgment API credential to the *Verify Extract* node, and set the Base URL if you are not using the default provider. - [ ] Install n8n-nodes-judgment from Settings → Community Nodes. See the note beside the first node. - [ ] Replace *Source Document* and *Fabricated Extraction* with your own extraction output, keeping the source_text and one field per extracted value. - [ ] Add two questions to *Verify Extract* for each field you want checked, following the existing pattern. - [ ] Review the 0.5 threshold in *Reshape Checks* against the cost of a wrong field reaching production. ### Customization Field names are the keys of the extraction object, so adding a field means adding its two questions. The check name carries the field, which is why one call covers a whole record. To build the full cascade, replace *Review Queue* with a stronger reasoning model that re-extracts just the flagged fields.
The steps
- When Clicking Test Workflow
- Verify Extract
- Reshape Checks
- Review Queue
- Confirmed
- Is the Field in Doubt?
- Explain the Flag
- Source Document
- Fabricated Extraction
- Two Records
Similar automations
Tasks & Project ManagementGrade LLM answers and route low-confidence results with Judgment API7 stepsReports, Analytics & DashboardsRank engineering candidates by role fit with weighted scoring in Judgment11 stepsTasks & Project ManagementScore contract renewal risk and route approvals from webhook intake14 stepsDocuments, PDF & OCRTrack contract renewals from Drive with LlamaParse, OpenAI and Slack alerts35 steps