Data Extraction with Language Models
DELM is a Python toolkit for extracting structured data from unstructured text using language models.
Load → split → score → filter → extract with schema validation → evaluate, all checkpointed so interrupted runs resume where they stopped.
Features
- Multiple input formats: TXT, HTML, MD, DOCX, PDF, CSV, Excel, Parquet, Feather
- Flexible schemas: Simple key-value → nested objects → multiple schemas
- Multiple LLM providers: OpenAI, Anthropic, Google, Groq, Together AI, Fireworks AI
- Cost management: Automatic cost tracking, caching, and budget limits
- Built for scale: Batch processing with parallel execution and checkpointing
Installation
pip install delm
Agent Skill
The LLM labeling skill guides coding agents to use DELM for labeling, annotation, classification, and structured extraction. Copy skills/llm-labeling/ into your agent's skills directory to use it.
Quick Start
Define your extraction schema and extract structured data in just a few lines:
from delm import DELM, Schema, ExtractionVariable
# Define what to extract
schema = Schema.simple(
variables_list=[
ExtractionVariable(
name="company",
description="Company name mentioned",
data_type="string",
required=True,
),
ExtractionVariable(
name="price",
description="Price value if mentioned",
data_type="number",
required=False,
),
]
)
# Initialize and extract
delm = DELM(
schema=schema,
provider="openai",
model="gpt-4o-mini",
)
# Extract from any supported file format
results = delm.extract("data/earnings_calls.txt")
print(results)
# Check costs
print(delm.get_cost_summary())
Schema Types
DELM supports three schema types for different extraction needs:
Simple Schema
Extract key-value pairs from text:
schema = Schema.simple(
variables_list=[
ExtractionVariable(name="author", data_type="string"),
ExtractionVariable(name="date", data_type="date"),
]
)
Nested Schema
Extract lists of structured objects:
schema = Schema.nested(
container_name="products",
variables_list=[
ExtractionVariable(name="name", data_type="string"),
ExtractionVariable(name="price", data_type="number"),
ExtractionVariable(name="features", data_type="[string]"),
]
)
Multiple Schemas
Extract multiple different schemas simultaneously:
schema = Schema.multiple({
"companies": Schema.nested(
container_name="companies",
variables_list=[...],
),
"products": Schema.nested(
container_name="products",
variables_list=[...],
),
})
Supported Data Types
| Type | Description | Example |
|---|---|---|
string |
Text values | "Apple Inc." |
number |
Floating-point | 150.5 |
integer |
Whole numbers | 2024 |
boolean |
True/False | true |
date |
Date strings | "2025-09-15" |
[string] |
List of strings | ["oil", "gas"] |
[number] |
List of numbers | [100, 200] |
Advanced Features
Custom Prompts
delm = DELM(
schema=schema,
provider="openai",
model="gpt-4o-mini",
prompt_template="""You are a financial data extraction expert.
Extract the following information:
{variables}
Text to analyze:
{text}""",
)
Process CSV/Structured Data
delm = DELM(
schema=schema,
provider="openai",
model="gpt-4o-mini",
target_column="transcript_text", # Column containing text to process
)
results = delm.extract("earnings_data.csv")
Cost Tracking & Limits
delm = DELM(
schema=schema,
provider="openai",
model="gpt-4o-mini",
track_cost=True,
max_budget=10.0, # Stop if cost exceeds $10
)
results = delm.extract("data.txt")
summary = delm.get_cost_summary()
print(f"Total cost: ${summary['total_cost']:.2f}")
Batch Processing
delm = DELM(
schema=schema,
provider="openai",
model="gpt-4o-mini",
batch_size=50, # Process 50 records per batch
max_workers=5, # Use 5 parallel workers
)
results = delm.extract("large_dataset.csv")
Configuration Options
For a complete list of configuration options, see the documentation.
Common parameters:
provider: LLM provider ("openai","anthropic","google", etc.)model: Model name ("gpt-4o-mini","claude-3-sonnet-20240229", etc.)temperature: Generation temperature (default:0.0)batch_size: Records per batch (default:10)max_workers: Concurrent workers (default:1)track_cost: Enable cost tracking (default:True)max_budget: Maximum cost limit in dollars (default:None)target_column: Column name for CSV/tabular data (default:None)
Documentation
Learn more about:
File Format Support
| Format | Extensions | Additional Dependencies |
|---|---|---|
| Text | .txt |
None |
| HTML/Markdown | .html, .htm, .md |
beautifulsoup4 |
| Word | .docx |
python-docx |
.pdf |
marker-pdf |
|
| CSV | .csv |
pandas |
| Excel | .xlsx |
openpyxl |
| Parquet | .parquet |
pyarrow |
| Feather | .feather |
pyarrow |
Contributing
We welcome contributions! Please see our documentation for guidelines.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
- Built on Instructor for structured outputs
- Uses Marker for PDF processing
- Developed at the Center for Applied AI at Chicago Booth
Metadata
Release files for delm 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| delm-1.2.1.tar.gz | 76.6 kB | With provenance | Details for delm-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| delm-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for delm-1.2.1-py3-none-any.whl |
Total release size: 161.1 kB
Release files / delm-1.2.1.tar.gz
| Download URL | delm-1.2.1.tar.gz |
|---|---|
| Size | 76.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b148896fc1dd501891af268df45dfcb41143d00f97d7682e1e3992b3e008269b
|
|
BLAKE2b-256 checksum How to use checksums |
76b679a0b28e83de9f77d8c0773030bfb887113ec983e0a84972be6303d630de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / delm-1.2.1-py3-none-any.whl
| Download URL | delm-1.2.1-py3-none-any.whl |
|---|---|
| Size | 84.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb067232533d2a13981e09f613dabfba72074be5ded248ecc26620a5aed2b4aa
|
|
BLAKE2b-256 checksum How to use checksums |
b9703eeb2f6b78f4d0fab3b423df3b38dc508765e91f051e3f003f9e81147750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logSecurity for delm 1.2.1
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.
Attestation for delm-1.2.1.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 26, 2026.
Transparency logA 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.