Live demo
Documents: classify, extract, correct
Drop a rental agreement, an inspection report, or an invoice. @de_canter/apogee-documents-ai classifies it against the three types the rental company declared, extracts the fields from that type's Zod schema, and returns every claim as a kernel Assertion with its own confidence. Correct a value and the human assertion supersedes the model's; the audit log keeps the correction as ground truth for evals.
Domain
src/demo/rental/documents/taxonomy.ts: defineTaxonomy with three types and a defineExtraction per type. Nothing in the package knows what an invoice is.
Pipeline
processDocument runs classify then extract as a checkpointed pipeline; a failed stage keeps its error and can resume. Images and PDFs go to the model as media blocks; text as a document block.
Corrections
correctField confirms a human assertion at confidence 1 and supersedes the model's; the audit records who and when, and groundTruth turns corrected runs into eval cases.