Getting started¶
Install¶
Free and local models work too (Ollama, Gemini free tier). See Choosing an LLM.
PDFs are read with pdfplumber (MIT). PyMuPDF is an optional engine under the AGPL-3.0:
pip install "qaechi-parser[pymupdf]" adds it, and QAECHI_PDF_ENGINE picks the engine.
Parse a file¶
No keys yet?
Without an API key qaechi-parser runs in stub mode and returns nulls,
so you can wire your UI before the model is configured.
How it works¶
One request becomes one job. The pipeline picks how to read the document, and every job
ends in the same save step, so the result always has the same shape.
Flow¶
flowchart LR
CLI(["CLI<br/>qaechi-parser parse"]) --> F
API(["HTTP<br/>POST /jobs"]) --> Q["job queued<br/>202 + jobId"] --> F
F["<b>fetch</b><br/>local file or<br/>HTTP object store"] --> R["<b>read</b><br/>the reader for<br/>docType + format"]
R --> V["<b>save</b><br/>Extraction with<br/>quote + page per value"]
V --> ST[("store<br/>job succeeded")]
classDef key stroke:#e0b400,stroke-width:2.5px
classDef io stroke-dasharray:2 2
class R,V key
class CLI,API,Q io
Extraction in detail¶
flowchart TB
L["<b>load</b><br/>PDF, PPTX, XLSX, CSV, TXT, MD<br/>every sheet, shape, chart and note"]
C["<b>chunk</b><br/>within the size budget<br/>a table stays with its header"]
R["<b>index + retrieve</b><br/>opt-in QAECHI_RETRIEVE: top 6 chunks per field<br/>off: all chunks"]
E["<b>extract</b><br/>structured output, a quote per value"]
G["<b>grade</b><br/>yes / no / unknown"]
GD{"verdict no, QAECHI_REWRITE on<br/>and context left?"}
W["<b>rewrite</b><br/>widen to all chunks"]
QC["<b>quote check</b><br/>every quote matched verbatim<br/>misses go to quoteCheck.notInSource"]
V["<b>save</b>"]
L --> C --> R --> E --> G --> GD
GD -- "yes, once" --> W
W --> E
GD -- "otherwise" --> QC --> V
classDef key stroke:#e0b400,stroke-width:2.5px
classDef decide stroke:#e0b400,stroke-dasharray:4 3
classDef io stroke-dasharray:2 2
class E,QC,V key
class GD decide
| Step | What it does | Where it can stop |
|---|---|---|
| fetch | Reads a local path or downloads from the HTTP object store, then asks the parser registry for a match on docType + extension (+ sourceKind). |
No source backend, or no way to read the document: stub mode. |
| parse | A registered plugin reads the file itself, confidence 1.0. | LayoutError when the file does not look as expected. It fails rather than misreads. |
| load | Turns the file into pages with anchors: all sheets (hidden too), grouped shapes, chart values, speaker notes. | Pages with no text are listed in notes. |
| chunk | Cuts pages within the size budget. A table always stays with its header. | |
| index / retrieve | Opt-in (QAECHI_RETRIEVE). Narrows long documents to the top 6 chunks per field. Off: every chunk is sent. |
|
| extract | Structured output from the fields you asked for. Each value carries a quote. |
Unsure values come back as null. |
| grade | A second pass labels the result yes / no / unknown. No key means unknown. |
|
| rewrite | Opt-in (QAECHI_REWRITE). On a clear no, extracts once more with the full context. |
At most once, and only if there is context left to add. |
| save | Builds the Extraction, matches every quote verbatim against the source, stores it and marks the job succeeded. |
Each step checks the job deadline (QAECHI_JOB_TIMEOUT_SECONDS, default 1,800 s); a finished result is always saved. |