ContextGem is a Python open-source framework to extract structured data from documents using LLMs, with features for aspects and concepts, references, and justifications. It supports multiple LLMs and a declarative pipeline; latest releases expand reasoning controls and licensing artifacts.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
ContextGem is a free, open-source LLM framework that makes it easier to extract structured data and insights from documents, with minimal code. It supports extracting aspects and concepts, granular reference mapping, and built-in justifications, all within a unified, serializable document model.
How it works
The workflow involves:
- Defining a Document with text (and visuals) to analyze.
- Defining what to extract: Aspects (text segments) and Concepts (data points).
- Running an LLM to perform extraction, optionally using a group of LLMs for complex tasks.
Key components include Document, Aspect, Concept types, and a DocumentLLM helper to run extraction. The README shows examples of adding concepts and aspects, and using llm.extract_all(document).
Getting started
Installation methods shown:
uv add contextgem
or
pip install -U contextgem
Usage example demonstrates creating a Document with raw_text, attaching a StringConcept, configuring a DocumentLLM with a model and API key, and executing extraction via llm.extract_all(doc).
Recent releases
- v0.26.0 (2026-07-28): Added "none" and "max" reasoning effort values, extending accepted set to litellm vocabulary.
- v0.25.1 (2026-06-06): Added license-based dependency audit artifacts (
LICENSES.md,licenseal.review.toml) and CI workflow; and fixedLiteraltype-hint serialization/deserialization. - v0.25.0 (2026-05-07): Changed concurrency for sub-aspect/sub-concept extraction to use
asyncio.gatherwhenuse_concurrency=True. - v0.24.0 (2026-05-05): Added runtime network egress scopes via tethered for non-LLM paths; SaT model downloads handled in
_load_sat_model. - v0.23.0 (2026-05-05): Upgraded pinned dependency versions including
litellm,openai, andgenai-prices.
Traction
- Stars: 1869
Behind the repo
- License: Apache-2.0
- Language: Python
- Created: 2024-10-11
- Last push: 2026-07-28
- Forks: 160
- Open issues: 0
Caveats
- License: Apache-2.0
- Age: created 2024-10-11; last push 2026-07-28
- Open issues: 0





