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.
  • Fits into agentic workflows: extracts the metadata of documents at ingestion, runs as a tool that an agent calls, and decides the next step of a workflow, or the tools that an agent gets, with probabilities.
  • 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, decision models and agentic workflows, 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.1.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.1.0
File Size Uploaded Provenance
contextgem-1.1.0.tar.gz 247.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for contextgem 1.1.0
File Interpreter ABI Platform
contextgem-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 536.7 kB

Release files / contextgem-1.1.0.tar.gz

Download URL contextgem-1.1.0.tar.gz
Size 247.3 kB
Tags Source
SHA-256 checksum
How to use checksums
380176a4fb684c847654ad3ad6f3557e08825efc629d8610c59969995ef91233
BLAKE2b-256 checksum
How to use checksums
daa6bb30729a4d1d3131829f65ab380c3ef1b13f73f426aedb25133fdb0f17cd
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.1.0-py3-none-any.whl

Download URL contextgem-1.1.0-py3-none-any.whl
Size 289.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cae2a10de095fae3f8f3c3dd63ba37684ccb214631c8cf1caaae88a071d2204
BLAKE2b-256 checksum
How to use checksums
776f20c4823bde731330a755cc1d68e90199181147fbe07cae50ec77dc26ae25
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

Security for contextgem 1.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for contextgem-1.1.0.tar.gz

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

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

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