Welcome to ContextGem Documentation!

ContextGem

Welcome to ContextGem Documentation!#

ContextGem is a free, open-source framework that makes it radically easier to extract structured data and insights from documents using LLMs and decision models — with minimal code.

Note

New in 1.0: decision models. Next to LLMs, ContextGem now works with decision models, which answer closed questions (yes/no, one of your labels, a level of a scale) with the probability of each possible answer, fast and at a low cost.

Upgrading from 0.x? Some classes and parameters are renamed or removed, some defaults have changed, and Python 3.10 is no longer supported. Follow the migration guide.


📚 Project Description

Learn about the motivation behind ContextGem and how it works.

Why ContextGem?
🚀 Getting Started

Instructions to install ContextGem and quickly start using it.

Installation
📄 Documents

Learn how to create and configure documents to extract information (aspects and concepts) from.

Creating Documents
📋 Extracting Aspects

Learn how to identify and extract specific document sections like clauses, chapters, or terms using ContextGem’s Aspects API.

Aspect Extraction
🎯 Extracting Concepts

Learn how to extract and infer structured data like JSON objects, strings, numbers, dates, booleans, ratings, and labels from documents using ContextGem’s Concepts API.

Supported Concepts
🔀 Extraction Pipelines

Learn how to create reusable extraction pipelines that combine aspects and concepts for consistent document analysis across multiple files.

Extraction Pipelines
🤖 Large Language Models

Learn about supported cloud LLM providers and local models, and how to configure and use them for extraction.

Supported LLMs
⚖️ Decision Models

Learn how to extract yes/no, label and rating concepts, as well as aspects, with decision models, which return probabilities instead of generating text.

Decision Models
⚡ Advanced Usage

Explore advanced features and techniques for extracting data from documents.

Advanced usage examples
⚙️ Optimization Guide

Learn how to optimize your extraction pipeline for accuracy, cost, and performance.

Choosing the Right LLM(s)
💾 Serialization

Learn how to serialize and deserialize ContextGem objects for storage and transfer.

Serializing objects and results
📖 API Reference

Complete API documentation for all ContextGem modules and classes.

Documents

Indices and tables#