coreason-refinery
coreason-refinery is the industrial processing plant for data ingestion at CoReason-AI. It transforms raw documents (PDF, Excel, PPTX) into semantically structured, machine-readable Markdown, ready for RAG (Retrieval-Augmented Generation) pipelines.
Unlike traditional RAG tools that blindly chunk text, coreason-refinery is Structure-Aware. It preserves the logical hierarchy of documents (headers, sections) and ensures complex artifacts like tables and equations are kept intact.
Features
- Multi-Modal Parsing:
- PDF: Vision-first parsing to preserve table grids and layout.
- Excel/CSV: Treated as relational data, converted to Markdown tables with header preservation.
- PowerPoint: Flattens slides into linear narratives (planned support for speaker notes).
- Semantic Segmentation:
- Splits documents by logical headers (#, ##) rather than character counts.
- Table Rescue: Never splits tables mid-row; merges tables spanning multiple pages.
- Context Injection ("Breadcrumbs"):
- Enriches every chunk with its hierarchical path (e.g.,
Context: Protocol > Section 4 > Toxicity). - Ensures LLMs understand the specific scope of any given text snippet.
- Enriches every chunk with its hierarchical path (e.g.,
- GxP Compliance Ready:
- Designed for lineage tracking and metadata enrichment.
Installation
pip install coreason-refinery
Note: This package requires Python 3.12+.
Usage
Here is how to initialize and run a refinery job:
import uuid
from coreason_refinery.models import IngestionJob, IngestionConfig
from coreason_refinery.pipeline import RefineryPipeline
# 1. Configure the Job
config = IngestionConfig(
chunk_strategy="HEADER",
segment_len=500
)
job = IngestionJob(
id=uuid.uuid4(),
source_file_path="path/to/document.pdf",
file_type="auto", # Infers PDF/Excel/CSV
config=config,
status="PROCESSING"
)
# 2. Run the Pipeline
pipeline = RefineryPipeline()
chunks = pipeline.process(job)
# 3. Inspect Results
for chunk in chunks:
print(f"--- Chunk ID: {chunk.id} ---")
print(chunk.text)
print(f"Metadata: {chunk.metadata}")
Architecture
The pipeline consists of three main stages:
- The Cracker (Parsing): Routes files to specialized parsers (
UnstructuredPdfParser,ExcelParser) to extract atomic elements. - The Cutter (Segmentation): Reassembles elements into
RefinedChunks based on document structure, applying "Rolling Context" to preserve hierarchy. - The Enricher (Metadata): (Planned) Adds lineage and semantic tags.
License
This software is proprietary and dual-licensed under the Prosperity Public License 3.0.
Commercial use beyond a 30-day trial requires a separate license.
See LICENSE for details.
Metadata
Release files for coreason-refinery 0.2.2
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 |
|---|---|---|---|---|
| coreason_refinery-0.2.2.tar.gz | 15.5 kB | With provenance | Details for coreason_refinery-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coreason_refinery-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for coreason_refinery-0.2.2-py3-none-any.whl |
Total release size: 35.3 kB
Release files / coreason_refinery-0.2.2.tar.gz
| Download URL | coreason_refinery-0.2.2.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7ae9db8f24192e967ad09bab26eb8fd07e3396cf6d24ea7a40b14347d149eea
|
|
BLAKE2b-256 checksum How to use checksums |
e9eb9836abdf0964f8a4d4be4077efaa35121dd8ec3d975b97563ed933f49433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 28, 2026.
Transparency logRelease files / coreason_refinery-0.2.2-py3-none-any.whl
| Download URL | coreason_refinery-0.2.2-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b7ed3407e9cd06710f14fe57ce5fa329e434779f30d1489c02f1d7147d27626
|
|
BLAKE2b-256 checksum How to use checksums |
27647bbca3ad6eb70281645df7175446ce6c393937a82c491043cc47b6cc54f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 28, 2026.
Transparency logSecurity for coreason-refinery 0.2.2
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
Both files in this release have been uploaded with provenance metadata.
Attestation for coreason_refinery-0.2.2.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 Jan 28, 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.