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-5.4-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-5.4-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-5.4-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.5.0.tar.gz (461.3 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.5.0-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for catchfly-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7c812bb0d6bb367ab60a7582f22bde932880bb7d858c7b81858859294050d309
MD5 04755052f91fbb8ca0e7b59e8acb8417
BLAKE2b-256 8a8f05e66be002cd13862dfc836efecefcb7ba09c3f6e2658c57100786b329a1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for catchfly-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a37c578f30e419e7b72b083ff8158f812d59ac34581dac92fb12dccdff405ef9
MD5 91ea8a0cee378af0b60d6a90773e6aea
BLAKE2b-256 be85e3421600442537f0ac844e0e857a228801bf1317f59fdefb33aacf9539b6

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