Skip to content

IDP Classify

Reads a document and tells which of the types you list it is. It returns the document already read together with the verdict, so IDP Extract does not have to read it again. And if the file holds several documents stuck together, it splits them into segments to extract each one separately.

IDP Classify path = = content["path"]
projects = ["device-record", "maintenance-report"]
credential = = credential("anthropic-key")
→ output: doc
If condition = = doc["recognized"] == false
Log message = = "None of the ones I know: " + doc["reason"]

The projects parameter takes the names of extraction projects of the environment. Each project declares its document type and a description; that is what the classifier reads to tell them apart. So the same place where you configure what to extract also defines which types there are to tell apart — you do not maintain two lists.

ParameterTypeWhat it is
pathtextThe path of the document.
projectslistThe types to tell apart: names of extraction projects of the environment. One is a legitimate case. For CI it also accepts an inline project-resolve JSON.
credentialcredentialZoan Cloud credential holding the API key. Use = credential("name").
modeltextClassifying is easy compared to extracting: a small model is plenty.
modeenumauto, text or azure-di.
dpiintThe dpi the boxes will come in. It travels with the document to IDP Extract, so it is said once.
pagestextWhich pages to read. Empty = all of them.
endpoint / azureCredentialAzure Document Intelligence, only for scans.

It is the whole document — the same one IDP Load Document returns — plus the verdict and the segments:

FieldWhat it is
documentTypeThe type, or unknown.
recognizedfalse when the type is unknown. The signal for your If: if it is false, do not extract — send it to quarantine/review.
reasonWhat in the document made it decide, quoting the text it leaned on.
segmentsThe logical documents the file holds, each { pageStart, pageEnd, type, recognized }. Each segment carries its real type.
splitNeedsReviewtrue when the split is low-confidence (there are unrecognized pages, or it was split into several with no printed marker). It’s the signal to send the bundle to the classification station.

Pass it as-is to IDP Extract in its document parameter and the file is not read again.

It splits files that hold several documents

Section titled “It splits files that hold several documents”

A client delivers a single PDF with the device record, the maintenance report, the calibration and annexes, all stuck together. IDP Classify classifies each page: its type and whether it starts a new document. A boundary opens when the type changes, when the model detects a start (letterhead, a new heading, a field that only appears on page 1) or when the printed mark “page 1 of N” appears. It groups the pages into contiguous segments, each with its real type.

A single-document file comes out as one segment — the normal case does not change.

For Each segment in = doc["segments"]
IDP Extract path = = file
project = = segment["type"]
pages = = segment["pageStart"] + "-" + segment["pageEnd"]

When the split isn’t clear: the classification station

Section titled “When the split isn’t clear: the classification station”

Splitting several documents of the same type stuck together with no marker is ambiguous. When confidence is low, IDP Classify flags it with splitNeedsReview = true. In that case, instead of extracting blindly, you send the bundle to the classification station with Documents Classify Bundle, a person confirms the boundaries/types, and Documents Take Confirmed extracts them.

If condition = = doc["splitNeedsReview"] == true
then:
Documents Classify Bundle path = = file, reference = = file,
segments = = doc["segments"], pages = = doc["pages"], dpi = 200
Continue

The classifier’s enum always includes that value, and it is not a detail.

Without an honest way out, the model picks the least bad type of the list — because the schema forces it to pick one. And a wrong document classified as good is the expensive failure: grounding does not catch it, because it verifies that the text is in the document, not that the document is the one you think. An invoice has numbers that look like serial numbers, and they would come out located and with high confidence.

“Is this a device record, yes or no?” is the most common question in a single-type queue. With one project, the enum is ["device-record", "unknown"] — and that second option is what makes the question meaningful.

Because what to do with a document you should not process is a playbook decision. An activity that decides on its own not to do its job hides the control flow, and it also prevents classifying once and routing to the right project — which is the real case of a queue with mixed documents.

It is the same design as UiPath (Classify DocumentExtract Document Data), and for the same reason.

Classifying costs one short call: the pages go in, the verdict and the segments come out. Extracting costs a single call per document (all fields at once).

On a 3-page device record, classifying costs about $0.003 and extracting about $0.041. Discarding before extracting saves 95% of the cost of a wrong document — and avoids putting plausible, false data into your system.