AI Pack for APEX Document Management
A language model reads the fields of your PDFs and images. Checks that you write in SQL decide which values are saved as metadata on the document, ready for your reports or your ERP. Everything else waits in a review queue for a person.
Or read the form extraction guide.
Extracted values
OKChecks
All checks passed: the result is accepted, and its values are saved on the document.
What it reads
ADM reads the text with Oracle Text, the same text that its search uses. Other files that Oracle Text reads, such as Word documents, work the same way.
Needs: A language model.
PNG, JPEG and other images go to a vision model, which recognizes the form and reads the values.
Needs: A vision model.
A PDF without a text layer has nothing to read. An OCR service turns it into text first. Without OCR, the document goes to review.
Needs: An OCR service.
Their layout carries the meaning, and the text loses it. Set such a form to send the PDF itself to a vision model.
Needs: A vision model that accepts PDF files.
How it works
Every document goes through the same five steps. Which form a document is, and whether its values are good enough, is decided by configuration that you control.
ADM gets the text of the document, or sends an image to a vision model.
Markers, patterns that you set for each layout, decide which form a document with text is, not the model. For an image without text, the vision model picks the form.
The model returns exactly the fields of your schema.
Your checks test the values: required, of the right type, and consistent with each other.
All checks pass: the values are saved as metadata on the document. Otherwise a person reviews it.
A saved value is an annotation on the document, such as invoice.total_amount = 557.63. Users search and filter on it, your reports read it from a view, and a hook can copy it into your ERP in the same transaction.
Checks
The JSON schema makes a field required, a number, or one of a list of values.
Lines add up to the net amount, net plus VAT is the total, opening balance plus transactions is the closing balance.
A quantity is positive, a VAT rate is 7 or 19, a credit note has a negative total.
Your PL/SQL hook can check values against your tables, for example that the purchase order exists, and refuse the result. The document then goes to review.
Checks catch values that do not fit together. They cannot prove that every value is right. A single check box or a free-text remark has no second value to compare with, and nothing to look up. For such fields, measure how often the model is right, and decide whether a review is cheaper than a mistake.
{
"json_schema": {
"type": "object",
"properties": {
"invoice_number": {"type": "string"},
"net": {"type": "number"},
"vat": {"type": "number"},
"total": {"type": "number"}
},
"required": ["invoice_number", "total"]
},
"annotation_fields": ["invoice_number", "total"],
"checks": [{
"name": "net + VAT = total",
"expr": "abs(net + vat - total) <= 0.01"
}]
}The document type says what to read and how to check it. Each supplier layout is a form of that type: a few markers that recognize it, and hints for that layout. A new supplier needs only a new form. Edit all of it in the form extraction manager, an APEX region that shows the text of a document and runs a test extraction before you save, or with the PL/SQL API. The guide covers every setting and the known limits.
Measurement
A model that is right on the three documents you tried can be wrong on the fourth. By default, approved results go into a test set with their right values. One call extracts the whole test set again and tells you, for each document, whether it was right, caught by a check, a false alarm, or wrong and saved. That last number is the one to bring to zero.
It also records the tokens and the seconds, and it can run the same test set with another model. So you compare quality and cost before you switch.
Case study
In our sample, checks sent every sign error in a bank statement to review instead of saving it. For timesheets and leave requests, sending the PDF to a vision model kept the layout, and every extraction was correct.
gpt-5.6-luna, a small, low-cost model. Every extraction was compared with the known correct values.Not tested: your documents, scanned PDFs (the scans were images), and other model families. Measure on your own forms.
| Document type | Processing method | Observed result |
|---|---|---|
| Certificates of analysis | Extracted PDF text (the scan: vision model) | All 15 extraction attempts correct (5 documents, 3 runs) |
| Utility bills (German) | Extracted PDF text | All 15 extraction attempts correct (5 documents, 3 runs) |
| Bank statements (English and German) | Extracted PDF text (the scan: vision model) | All 18 extraction attempts correct (9 documents, 2 runs), after adding sign rules and allowing statements without transactions |
| Timesheets (grid) | PDF sent to a vision model (the scan: image) | All 10 extraction attempts correct (5 documents, 2 runs) |
| Leave requests (check boxes) | PDF sent to a vision model (the scan: image) | All 10 extraction attempts correct (5 documents, 2 runs) |
| Letters (no form) | Form matching on the text | All 6 attempts correctly sent to review (2 letters, 3 runs) |
With the final configuration, no attempt saved an incorrect value. Before it, the bank statements already saved none: the balance check sent 2 sign errors to review, and 3 correct statements without transactions went to review because their table was empty. Timesheets and leave requests did save incorrect values when the model read the text: 13 of 30 attempts. That is part 3.
FAILED with a sentence for the reviewer.When the model read the extracted text, these two layouts saved incorrect values in 13 of 30 attempts. The values were in the text, but their position was not, and no check can recover information that the text does not contain.
One form setting: a vision model reads the PDF
With "model_input": "file", ADM still finds the form with the markers on the text. Then it sends the PDF itself to the vision model of the profile instead of the text. The vision model receives the page layout, including columns and check boxes.
{
"markers": [
"Brightline Staffing Ltd",
"^WEEKLY TIMESHEET$"
],
"model_input": "file"
}A smaller diagnostic experiment
| Input method | Run 1 correct | Run 2 correct |
|---|---|---|
| Extracted PDF text | 6 of 8 | 4 of 8 |
| PDF sent to vision model | 8 of 8 | 8 of 8 |
Sending the PDF increased the median processing time from 2.7 to 4.2 seconds and used about three times as many input tokens. Set it on the forms that need it, not on the whole profile.
The four timesheet and four leave request PDFs, two runs per method, with the same schema, checks and model. These are the documents that showed the problem, so this small sample is no error rate.
Will it work on your documents?
Contact us to arrange a test with your documents. We show you the extraction, the checks and a measurement on them.
Request a test with your documentsOr build it yourself: start the step-by-step tutorial.
Built into ADM
Form extraction runs on the documents, folders and permissions of APEX Document Management. The results are rows in your database.
Accepted values are saved as annotations on the document, such as invoice.total_amount = 557.63. Search and filter on them.
adm_my_form_extractions_v returns status, values and issues, only for the documents that the current user may see.
AFTER_FORM_EXTRACTION runs your PL/SQL in the same transaction when a result is accepted.
Extracts every new document and every new version of an inbox folder. Each one costs at least one model call.
Documents that need a person get a review tag. Approve them in the manager, or call approve from your own page.
An APEX region: edit the configuration, see the text and the matching markers, test an extraction, run measurements.
select document_name, status, form_code, issues
, json_value(fields, '$.total_amount')
as total
from adm_my_form_extractions_v
where profile_name = 'supplier_invoices';OpenAI, Anthropic, Google, OCI Generative AI, Mistral and Ollama, through the open-source PL/SQL library UC AI. API keys stay in APEX web credentials.
Oracle Database 19c or later, Oracle APEX 24.2 or later, APEX Document Management with the AI Pack (included with the ADM license and optional to install; see its install prerequisites), and access to a model provider.
Common questions about form extraction in APEX Document Management.
Contact us to arrange a test with your documents. We show you the extraction, the checks and a measurement on them. Or build it yourself with the step-by-step tutorial.