> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thickdot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How AI Extracts Data from Packing Slips

> Learn how the platform combines a generative AI Brain with OCR cross-referencing and confidence scoring to extract accurate data and prevent hallucinations.

The platform uses a two-layer extraction approach that pairs the flexibility of generative AI with the reliability of traditional OCR. Rather than relying on templates or fixed field positions, the AI reads your document as a whole, understanding layout, context, and structure the way a human would. OCR then independently reads the same pages, and the two outputs are compared to produce a per-field confidence score. This design means you get the broad document-handling capability of a large language model without the risk of silently incorrect data reaching your ERP.

## The AI Brain

The generative AI model (the "Brain") receives your full, native PDF or image in a single API call. There is no chunking, no page-by-page splitting, and no need to build or maintain field-position templates for each vendor's document format.

The Brain works in two phases:

1. **Page Classification** — Before extracting anything, the model identifies which pages in the document are actual packing slips. Cover pages, terms and conditions sheets, shipping carrier labels, and other non-relevant content are filtered out. Only classified packing slip pages continue to the extraction phase.
2. **Structured Extraction** — From the classified pages, the model extracts two categories of data:
   * **Header fields** — document-level data such as PO Number, Vendor Name, Ship Date, and Delivery Date.
   * **Line item fields** — row-level data such as Part Number, Description, Quantity Shipped, Unit of Measure, and any other fields you've configured.

The fields the Brain looks for are defined entirely by your extraction configuration, you specify which header fields and line item fields matter for your workflow, and the AI resolves them from whatever format the vendor uses.

<Info>
  The Brain can handle complex tables, non-standard or multi-column layouts, handwritten annotations, vendor-specific abbreviations, and even photos taken on a mobile device in the warehouse. It does not require any per-vendor setup or template maintenance.
</Info>

## OCR Cross-Reference

After the Brain produces its structured extraction, Tesseract OCR independently reads the same classified packing slip pages. OCR produces a flat, unstructured text layer — it doesn't understand the document semantically, but it reliably captures every string of characters that's visually present on the page.

The **Checker** stage then compares the AI's extracted values against the OCR text field by field:

* If the AI says `quantity = 50` and OCR also finds `"50"` on that page → **high confidence** — the value is corroborated and the field is eligible for auto-approval.
* If OCR cannot find the AI-extracted value anywhere on the page → **lower confidence** — the field is flagged and may trigger human review.

This two-layer approach is specifically designed to prevent AI hallucination from silently corrupting your ERP data. A hallucinated value, one the model generates that doesn't actually appear in the document, will almost never be corroborated by OCR, causing the confidence score to drop and the document to be routed for human review rather than auto-approved.

<Note>
  OCR runs only on pages the Brain classified as packing slips, not on the full document. This keeps processing fast while ensuring full coverage of all relevant content.
</Note>

## Confidence and Required Fields

Not all fields carry equal weight in the auto-approval decision. In your extraction configuration, you can mark specific fields as **Required**. A required field must be extracted with a confidence score at or above your configured threshold for the document to be eligible for auto-approval.

If a required field's confidence score falls below the threshold, because the AI extracted a value that OCR couldn't corroborate, or because the field couldn't be found at all, the document is automatically flagged as **Needs Review**.

To understand what was extracted from a specific document and why it was routed the way it was:

* The **Extracted Data** tab on the Document Details page shows every field value the platform extracted, along with its confidence score.
* The **Decision** tab explains the specific reason the document was approved, flagged, or rejected, including which field or match condition triggered the outcome.

<Tip>
  If a required field is consistently receiving low confidence scores for a particular vendor, review the **Extraction Config** in Admin to ensure the field label and expected format are described clearly.
</Tip>

## What the AI Can Handle

The platform is designed to work with the real-world variety of documents that arrive in a receiving workflow, not just clean, digital PDFs from a single ERP system.

<CardGroup cols={2}>
  <Card title="Digital PDFs" icon="file-pdf">
    Native PDFs exported from ERP or accounting systems, with embedded text and clean formatting. These typically produce the highest confidence scores.
  </Card>

  <Card title="Scanned Paper Documents" icon="scanner-image">
    Scanned packing slips, including older documents and those with stamps, handwritten quantities, or manual corrections marked on the page.
  </Card>

  <Card title="Warehouse Photos" icon="camera">
    Images taken on a mobile device directly in the receiving area. The AI handles perspective, shadows, and varying image quality without requiring a flatbed scan.
  </Card>

  <Card title="Multi-Page Documents" icon="file-lines">
    Documents containing multiple pages, the Brain identifies which pages are packing slips and ignores the rest, so you don't need to pre-process or split files before uploading.
  </Card>

  <Card title="Complex Table Structures" icon="table">
    Multi-column tables, merged cells, sub-totals, and non-standard row groupings. The AI understands the structure contextually rather than relying on column position.
  </Card>

  <Card title="Multi-PO Documents" icon="list-ol">
    Documents where line items reference more than one Purchase Order. The platform can identify and separate items by PO for independent matching and routing.
  </Card>
</CardGroup>

<Note>
  Extraction quality depends on document legibility. Severely damaged documents, extremely low-resolution scans, or images obscured by glare or heavy shadow may produce lower confidence scores. In these cases, the platform will route the document for human review rather than auto-approve — protecting your ERP data even when source documents are imperfect.
</Note>
