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.3.0.tar.gz (449.4 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.3.0-py3-none-any.whl (44.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for catchfly-0.3.0.tar.gz
Algorithm Hash digest
SHA256 82008755eb4c5035ddf159c8e7a56415023d05e07b27f5feed949d0e19a098ae
MD5 78e907f07e3306592c2ce7e10e187888
BLAKE2b-256 2b554213f80cf12ffa668353957c412a4e9af1d5a8bbfeb88fd198c778633a49

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for catchfly-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64385367d2786c297fc3475c62fd650c4e6028e0c4ea0c2ad0b9bcf86e9941f0
MD5 4bab455b8de2a9e03046610c912aa8ca
BLAKE2b-256 b77d3ad912ade325cb79a1701b1137f34e2139007b7b2ce8d02e7b50923f6b6b

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