IDP Build Classifier
IDP Build Classifier
Section titled “IDP Build Classifier”Type: idp-build-classifier · Package: IDP Activities v1.18.0 · Output: object
Builds the schema that identifies which kind of document you are looking at, from the list of taxonomies you know. Run it through AI Extract before extracting, and let the playbook decide whether to carry on.
Why this is needed
Section titled “Why this is needed”Because IDP Ground does not cover this case, and it is worth understanding why.
Grounding verifies “this text is written in the document”. It does not verify “this document is the kind I think it is”. Feed an invoice to an equipment-record taxonomy:
- If you are lucky, the model returns
nullfor everything and the whole document goes to review. Expensive (a person looks at it) but nothing wrong is saved. - If you are not, the invoice carries a number that looks like a serial number. The model puts it in. And grounding confirms it, because that text is in the document. High confidence, auto-accepted, a wrong value saved with nobody looking.
That second case is what justifies classifying first.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
taxonomies | list | The taxonomies to choose between: paths to .json files, or the objects. A single one is fine too. |
Output
Section titled “Output”Returns an object holding the JSON Schema, ready for AI Extract. The model’s answer carries two fields:
| Field | What it is |
|---|---|
documentType | One of your taxonomies’ documentType values, or "unknown". |
reason | What in the document made it decide that. |
The enum builds itself
Section titled “The enum builds itself”The list of types comes from the taxonomies themselves, so it cannot drift: add a new type to the project and the classifier knows about it without you touching anything. Each taxonomy’s description is passed to the model as context for telling them apart — one more reason to write it well.
Example
Section titled “Example”IDP Build Classifier taxonomies = = [asset("taxonomies/device-record.json"), asset("taxonomies/invoice.json")] → output: classifier
IDP Load Document path = = docPath → output: docAI Extract credential = = credential("anthropic-key") prompt = = doc["text"] schema = = classifier → output: kindIf condition = = kind["documentType"] == "hoja-de-vida-equipo-biomedico" ...extract with the device-record taxonomyElse Log message = = "Discarded: " + kind["documentType"] + " — " + kind["reason"]Classifying is cheap: the document goes in once and the answer is three fields, so a small model is enough. What really saves money is what it prevents — not paying to extract a document that never belonged.
Related activities
Section titled “Related activities”- IDP Build Schema — the next step, once you know what it is.
- IDP Ground — verifies the values, not the kind of document.