Metadata-Version: 2.4
Name: raggae
Version: 0.2.0
Summary: Core library for RAG document understanding and retrieval
Requires-Python: >=3.13
Requires-Dist: cryptography==50.0.0
Requires-Dist: pikepdf==10.12.0
Requires-Dist: pillow==12.3.0
Requires-Dist: pydantic==2.13.4
Requires-Dist: pypdf==6.16.2
Provides-Extra: image-pdf
Requires-Dist: pypdfium2==5.13.0; extra == 'image-pdf'
Provides-Extra: table-ocr
Requires-Dist: img2table==1.4.0; extra == 'table-ocr'
Provides-Extra: text-html
Requires-Dist: beautifulsoup4==4.15.0; extra == 'text-html'
Requires-Dist: trafilatura==2.2.0; extra == 'text-html'
Provides-Extra: text-markdown
Requires-Dist: markdown-it-py==4.2.0; extra == 'text-markdown'
Provides-Extra: text-office
Requires-Dist: openpyxl==3.1.5; extra == 'text-office'
Requires-Dist: python-docx==1.2.0; extra == 'text-office'
Requires-Dist: python-pptx==1.0.2; extra == 'text-office'
Provides-Extra: text-pandas
Requires-Dist: openpyxl==3.1.5; extra == 'text-pandas'
Requires-Dist: pandas==2.3.3; extra == 'text-pandas'
Provides-Extra: text-pdf
Requires-Dist: pdfminer-six==20260107; extra == 'text-pdf'
Requires-Dist: pdfplumber==0.11.10; extra == 'text-pdf'
Requires-Dist: pypdfium2==5.13.0; extra == 'text-pdf'
Provides-Extra: text-tesseract
Requires-Dist: pytesseract==0.3.13; extra == 'text-tesseract'
Provides-Extra: text-unstructured
Requires-Dist: unstructured[docx,md,pptx,xlsx]==0.27.8; extra == 'text-unstructured'
Description-Content-Type: text/markdown

<p align="center">
  <img src="docs/assets/logo.png" alt="raggae logo" width="240">
</p>

# raggae

A Python SDK for RAG document understanding and retrieval.

Requires Python 3.13 or later.

## Installation

```bash
pip install raggae
```

## Document normalization

Use a worker on its own, or let `DocumentNormalizer` select a sequence from a
file's extension. Originals are never overwritten.

```python
from raggae.documents.normalization import StrictTextEncodingNormalizer

result = StrictTextEncodingNormalizer().normalize(
    source=b"Caf\xe9",
    output_path=None,  # Keep the changed copy in memory.
    declared_encoding="cp1252",
)
if result.artifact is not None:
    print(result.artifact.read_bytes().decode("utf-8"))  # Café
```

For a file-based flow:

```python
from raggae.documents.normalization import DocumentNormalizer

result = DocumentNormalizer().normalize(
    source="uploaded.pdf",
    output_path="prepared.pdf",  # A new path whose parent folder already exists.
)
print(result.outcome)  # changed, no_change, or failed
for step in result.report.steps:
    print(step.worker, step.report.outcome)
```

Default sequences include format-specific active-content and metadata cleanup;
pass `workers=(...)` to choose your own changes. A password-required PDF also
needs `password=...`. In-memory inputs need `source_format=...` when using the
default sequence. A `no_change` result returns the original artifact without
creating an output file; a `failed` result has no artifact.

Workers cover text encoding, image orientation, PDF decryption, selected
active-content and metadata removal, and explicit format conversion. The
`DocumentToHtmlConverter` requires a separately installed Pandoc, and
`LibreOfficeToPdfConverter` requires LibreOffice. Conversion does not perform
OCR, and sanitization is not a guarantee that a document is safe for every use.

For development checks and release setup, see [CI/CD documentation](docs/ci-cd.md).
