Skip to main content

Many strategies, one pipeline — from unstructured text to structured data.

Project description

catchfly

Many strategies, one pipeline — from unstructured text to structured data.

Catchfly automates the pipeline of schema discovery → structured extraction → normalization from unstructured text at scale. Interchangeable strategies at each stage let you go from raw documents to clean, normalized, structured data with minimal effort.

Quick Start

pip install catchfly[openai,clustering]
from catchfly import Pipeline
from catchfly.demo import load_samples

# Load built-in demo data (10 product reviews)
docs = load_samples("product_reviews")

# One line to create a full pipeline
pipeline = Pipeline.quick(model="gpt-4o-mini")

# Discover schema → extract records → normalize values
results = pipeline.run(
    documents=docs,
    domain_hint="Electronics product reviews",
    normalize_fields=["pros"],
)

print(results.schema)            # Discovered Pydantic model
print(results.to_dataframe())    # Extracted + normalized data
print(results.report)            # Cost & usage stats

Local Models (Ollama)

pipeline = Pipeline.quick(
    model="qwen3.5",
    base_url="http://localhost:11434/v1",
)

Modular Usage

Each stage works independently:

# Discovery only
from catchfly.discovery.single_pass import SinglePassDiscovery
discovery = SinglePassDiscovery(model="gpt-4o-mini")
schema = discovery.discover(documents=docs, domain_hint="...")

# Extraction only (bring your own schema)
from catchfly.extraction.llm_direct import LLMDirectExtraction
extractor = LLMDirectExtraction(model="gpt-4o-mini")
records = extractor.extract(schema=MyModel, documents=docs)

# Normalization only (bring your own data)
from catchfly.normalization.embedding_cluster import EmbeddingClustering
normalizer = EmbeddingClustering(embedding_model="text-embedding-3-small")
mapping = normalizer.normalize(values=["NYC", "New York", "NY"], context_field="city")

Async Support

All strategies provide async methods — async-first, sync-friendly:

# Async
results = await pipeline.arun(documents=docs, domain_hint="...")

# Sync (works in notebooks too)
results = pipeline.run(documents=docs, domain_hint="...")

Installation

pip install catchfly                        # Core only (~5 MB)
pip install catchfly[openai]                # + OpenAI SDK
pip install catchfly[clustering]            # + scikit-learn, numpy, umap
pip install catchfly[export]                # + pandas, pyarrow
pip install catchfly[all]                   # Everything

Or with uv:

uv add catchfly[openai,clustering]

Features

  • Schema Discovery — LLM proposes a Pydantic schema from sample documents
  • Structured Extraction — LLM extracts data per-document with retries and validation
  • Normalization — Cluster and canonicalize messy values (embedding + HDBSCAN)
  • Async-first — All operations support async with sync wrappers
  • LLM-agnostic — Works with any OpenAI-compatible endpoint (OpenAI, Ollama, vLLM)
  • Lightweight core — Only pydantic + httpx; heavy deps are optional
  • Production-ready — Error handling, cost tracking, provenance, export to DataFrame/CSV/Parquet

Requirements

  • Python 3.10+
  • An OpenAI-compatible LLM endpoint

License

Apache 2.0 — see LICENSE.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

catchfly-0.1.0.tar.gz (435.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

catchfly-0.1.0-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file catchfly-0.1.0.tar.gz.

File metadata

  • Download URL: catchfly-0.1.0.tar.gz
  • Upload date:
  • Size: 435.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for catchfly-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f2178b513a6b16ca61af4a9bb4227616913a64e7a347d5e0854a9ba1a7d8eed0
MD5 68ff78c1e24b043e3c1f8f7670ace463
BLAKE2b-256 9104263734916db8e4428ef48e93b596856526fb833352fdd198f5562ea030e3

See more details on using hashes here.

File details

Details for the file catchfly-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: catchfly-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for catchfly-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ca38dc24cb2102d7d5893078b360ffc2e8bbf884333b4226bd2b3509be8a4fa
MD5 31f7b1d6146b5acc585b8cade3ba260a
BLAKE2b-256 5024dbf964049ba952548436bfd191562cf4ae9be64f4cf7b44b85de4394d117

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page