ContextGem
Describe, don't prompt. ContextGem is a free, open-source framework that does the work around the models for you: you describe what to extract, and it handles the prompts, the data models, the source references and the justifications, with minimal code.
Upgrading from 0.x? ContextGem 1.0 renames and removes classes and parameters, changes some defaults and drops Python 3.10, so code and serialized data written for 0.x may need changes. Follow the migration guide.
uv add contextgem
Or, with pip: pip install -U contextgem.
- Generates the prompts from your descriptions of what to extract: there are no prompts to write.
- Returns typed, validated values: text, numbers, dates, booleans, labels, ratings and JSON objects.
- Maps each extracted item back to the paragraphs or sentences of the document that it came from, and can give the reasoning behind it.
- Extracts in context: aspects, sub-aspects and concepts focus the model on the text that matters.
- Runs as one declarative pipeline, reusable and serializable, with model routing, fallbacks and cost tracking.
- Uses the right model for each question: cloud and local LLMs through LiteLLM where it takes reasoning, and decision models where a fast, low-cost answer is enough.
- Gives the probability of each possible answer of a decision model, so that you set the threshold.
- Is built for in-depth analysis of individual documents, not for cross-document querying or corpus-wide retrieval.
See the documentation for the quickstart, how it works and decision models, the repository for the overview and the source, and the changelog for the version history.
Licensed under Apache-2.0.
Metadata
Release files for contextgem 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| contextgem-1.0.0.tar.gz | 243.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| contextgem-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 529.2 kB
Release files / contextgem-1.0.0.tar.gz
| Download URL | contextgem-1.0.0.tar.gz |
|---|---|
| Size | 243.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36e9b099c0c751ed8efbdb9efacc69ce15b05331a303bf74df5118b6e86bfb46
|
|
BLAKE2b-256 checksum How to use checksums |
6e95811eb036af933c0eab8e24caa8152116a29147ac2569818a4300c0cc9118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / contextgem-1.0.0-py3-none-any.whl
| Download URL | contextgem-1.0.0-py3-none-any.whl |
|---|---|
| Size | 285.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df53314a2b8ab4e01098fc5bb176b9201bcb8d6f67cedb6e7df53d35697fbf52
|
|
BLAKE2b-256 checksum How to use checksums |
54f1f4b0bf63757f5d6005c69590808eff2e78e59456bce172bdde1191088381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log