Skip to content

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.

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 null for 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.

ParameterEditorDescription
taxonomieslistThe taxonomies to choose between: paths to .json files, or the objects. A single one is fine too.

Returns an object holding the JSON Schema, ready for AI Extract. The model’s answer carries two fields:

FieldWhat it is
documentTypeOne of your taxonomies’ documentType values, or "unknown".
reasonWhat in the document made it decide that.

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.

IDP Build Classifier taxonomies = = [asset("taxonomies/device-record.json"), asset("taxonomies/invoice.json")] → output: classifier
IDP Load Document path = = docPath → output: doc
AI Extract credential = = credential("anthropic-key")
prompt = = doc["text"]
schema = = classifier
→ output: kind
If condition = = kind["documentType"] == "hoja-de-vida-equipo-biomedico"
...extract with the device-record taxonomy
Else
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.