contextgem vs docling-graph
Declarative LLM extraction from documents: describe Aspects and Concepts in plain language, get structured values back with paragraph- or sentence-level references and built-in justifications. — versus — Documents to validated knowledge graphs: Docling parses, an LLM or VLM fills Pydantic schemas, and you get a directed NetworkX graph with provenance, Cypher/CSV export and HTML views.
Both fill typed schemas from documents with an LLM. docling-graph aims outward at a validated knowledge graph — entities and relations across a corpus; ContextGem deliberately stays inside one document, tying each extracted value back to the sentences that support it.
| contextgem | docling-graph | |
|---|---|---|
| Stars | 2.0k | 800 |
| Forks | 183 | 84 |
| Language | Python | Python |
| License | Apache-2.0 | MIT |
| Last activity | 11 days ago | 5 days ago |
| Topics | ocr, data | knowledge-graphs, ocr |
| Curated connections | 7 | 5 |
contextgem — the curator's take
Its thesis is explicitly anti-RAG: stop chunking and retrieving, put the whole document in a long context window and extract in place. You declare Aspects — the sections or themes worth pulling — and Concepts — the entities, booleans, numbers, ratings and JSON objects inside them — and the framework writes the prompts, builds the validation models, and returns every item with reference_paragraphs, reference_sentences and a justification. That provenance is the point: it makes contract and filing review defensible rather than merely plausible. Two limits it states about itself: no cross-document querying or corpus-wide retrieval, so reach for a real RAG framework there; and its detailed instruction style wants a model at gpt-4o-mini level or better, so 8B local models will struggle even though LiteLLM happily points it at Ollama.
docling-graph — the curator's take
Built for the domains where an approximate embedding is worthless — chemistry, finance, legal — because what you need is the exact edge between a compound and a reaction or an instrument and its dependency. Pydantic schemas make extraction validated rather than hopeful, template generation bootstraps those schemas from example documents or an OWL/RDFS ontology, the provenance ledger carries bounding-box geometry with no extra LLM calls, and graph fusion merges multiple graphs deterministically. Under the Linux Foundation AI & Data umbrella with the Docling project's engineering behind it. Caveats: you own the schema design, which is the actual work; VLM extraction needs the heavy `vlm` extra plus local GPU or a served model; and the output is a NetworkX graph you export, not a queryable graph database.