The high-leverage decision is routing: classify the document type before extraction so each document goes to the right pipeline, schema, and validation rules.
TL;DR: Route first. Extract second. Validate always. The wrong pipeline creates an extraction error before extraction begins. Classify document type upfront, enforce the right schema per pipeline, and treat unknown/low-confidence as a valid system outcome that goes to review.
One general extraction prompt works for demos. In production, invoices, contracts, identity documents, and letters are different problems — each needs different schemas, prompts, layout handling, model tiers, validation rules, and human-review policies.
Add a routing layer: classify the document type first, then route to a specialized pipeline. The router decides which extraction pipeline, which schema to enforce, whether a low-cost path is sufficient, if table/long-context reasoning is needed, and whether uncertainty is high enough to require review. Unknown or low-confidence documents should not be forced into a pipeline — flag and queue for review.
Better extraction quality plus improved cost control, lower latency, easier maintainability, per-document-family monitoring, and safe handling of unknown document types. Routing is the architecture behind reliable Document AI.
Design insight: Route first. Extract second. Validate always. The wrong pipeline creates an extraction error before extraction begins. Classify document type upfront, enforce the right schema per pipeline, and treat unknown/low-confidence as a valid system outcome that goes to review.