Skip to content

feat(files): Docling extraction + MINT document serialization - #1

Closed
hshekhar-git wants to merge 2 commits into
mainfrom
feat/docling-mint-document
Closed

hshekhar-git wants to merge 2 commits into
mainfrom
feat/docling-mint-document

Conversation

@hshekhar-git

Copy link
Copy Markdown
Member

Summary

  • Adds a Docling-based file extractor as the default for file ingestion, spawned as a Python subprocess (python/docling_extract.py via docling-client.service.ts), with graceful fallback to the existing Gemini extractor on any failure (missing runtime, parse error, etc.).
  • Serializes the extracted document structure to MINT via a new mapper (structureToMint → encodeDocument from @q1k-oss/mint-format) and stores it in files.mint_content for token-efficient prompt injection.
  • DocumentStructure gains figures[] + section pageRef; new extractor config option; CLAUDE.md added (was missing); scripts/smoke-docling.ts verifies the structure→MINT path.

Dependencies

  • Requires @q1k-oss/mint-format ≥ 1.1.0 (adds encodeDocument/decodeDocument) — see feat(document): MINT document representation for parsed files mint-format#2. Merge + publish that first; this PR's package.json already points at ^1.1.0.
  • Docling is a Python dep (pyproject.toml, uv); first run downloads models. Not required for tests — the Gemini fallback covers a missing runtime.

Test plan

  • npm run build — clean tsc
  • npx tsx scripts/smoke-docling.ts — structure→MINT mapping renders §-headings/tables/lists/figures and round-trips via decodeDocument
  • uv sync && npx tsx scripts/smoke-docling.ts <sample.pdf> — real Docling extraction (run where Docling is installed)
  • Apply files.mint_content column via npm run db:push
  • Upload a sample SOP PDF via POST /api/files/upload → processingStatus=completed, mint_content populated

Adds a Docling-based file extractor (python/docling_extract.py, spawned by
docling-client.service.ts) as the default, with graceful fallback to the
existing Gemini extractor on any failure. Extracted document structure is
serialized to MINT via the new mint-mapper (encodeDocument from
@q1k-oss/mint-format >=1.1.0) and stored in files.mint_content for
token-efficient prompt injection.

- file.types: DocumentStructure gains figures[] + section pageRef
- schema: files.mint_content column (apply via db:push)
- config: extractor option ('docling' | 'gemini')
- adds CLAUDE.md (extractor flow, Docling/uv setup, MINT usage)
- scripts/smoke-docling.ts verifies the structure -> MINT path
@avnsh avnsh closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants