Skip to main content

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)

Source distribution for contextgem 1.0.0
File Size Uploaded
contextgem-1.0.0.tar.gz 243.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for contextgem 1.0.0
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.4

2 release files

0.19.3

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page