raggae
Raggae is a modular Python SDK for building retrieval-augmented generation (RAG) pipelines: turning source material into useful evidence for language models. Its scope is the full RAG workflow, from document ingestion to retrieval and answer generation.
Use individual workers when you need one operation, or use a stage coordinator to run related workers together. Policies let you configure limits and behavior, and structured results expose what happened without requiring you to parse logs.
Installation
pip install raggae
Available capabilities
| Stage | What it does today | Coordinator |
|---|---|---|
| Validation | Checks filenames, file identity, content signatures, PDF encryption, format-specific resource limits, active content, and PDF reading capability. Returns a decision with findings and a check history. | DocumentInspector |
| Normalization | Converts text encodings, applies image orientation, decrypts PDFs with a supplied password, removes selected active content and metadata, and explicitly converts supported formats. | DocumentNormalizer |
| Layout analysis | Locates document regions, suggests geometric reading order, identifies containment and caption candidates, and detects repeated PDF headers and footers. | DocumentLayoutAnalyzer |
Layout discovery supports PDF, Word (.docx), PowerPoint (.pptx), Excel
(.xlsx), and HTML. Model-based discovery supports PDFs and images through an
injected local detection service, with Paddle and Docling adapters available.
Document utilities also prepare annotated images showing region boxes and reading-order arrows. You decide whether to display or save those images.
Quick start
Inspect a document
from raggae.documents.validation import DocumentInspector
report = DocumentInspector().validate("uploaded.pdf")
print(report.decision) # accept, accept_with_warnings, needs_password, or reject
print(report.accepted)
for item in report.findings:
print(item.finding.code, item.finding.message)
The inspector combines the default checks. Workers and policies are also
importable directly from raggae.documents.validation for custom assemblies
or isolated use.
Normalize a document
Use a worker on its own, or let DocumentNormalizer select a sequence from a
file's extension. Originals are never overwritten.
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:
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 source=Artifact(path="protected.pdf", password="...") (import Artifact
from raggae.documents.normalization). 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.
Analyze document layout
Install the optional dependencies for the formats you use. For PDF discovery and rendering:
pip install "raggae[layout-pdf,layout-visual]"
from raggae.documents import DocumentRegionRenderer
from raggae.documents.layout_analysis import DocumentLayoutAnalyzer
report = DocumentLayoutAnalyzer().analyze("report.pdf")
print(report.outcome)
for region in report.layout.regions:
print(region.id, region.kind, region.bbox)
if report.outcome in ("success", "partial"):
images = DocumentRegionRenderer().render("report.pdf", layout=report.layout)
try:
for page_number, image in images.items():
image.save(f"layout-page-{page_number}.png")
finally:
for image in images.values():
image.close()
The report keeps discovery, reading-order suggestions, relationships, and repeated-margin results together. Layout analysis returns locations and links; text extraction and semantic content assembly are separate work.
For a single discovery worker, use, for example,
NativePdfLayoutAnalyzer().analyze("report.pdf"). Workers return a shared
LayoutAnalysisResult schema. PDF and image regions use rectangles; Word and
HTML use element paths, and spreadsheets use cell ranges.
Optional layout dependencies
| Extra | Purpose |
|---|---|
layout-pdf |
Native PDF region discovery. |
layout-docx |
Word document structure. |
layout-pptx |
PowerPoint slide shapes. |
layout-xlsx |
Excel tables and occupied cell blocks. |
layout-html |
HTML document structure. |
layout-visual |
PDF rendering for visual discovery and annotated previews. |
layout-paddle |
Paddle-based local layout detection. |
layout-docling |
Docling-model local layout detection. |
Model-based discovery needs downloaded local model files and an explicitly
configured service. For visual PDF analysis, also install layout-visual.
Browse the source code for the available workers, policies, and stage coordinators.
Metadata
Release files for raggae 0.3.0
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 |
|---|---|---|---|---|
| raggae-0.3.0.tar.gz | 984.3 kB | With provenance | Details for raggae-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| raggae-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for raggae-0.3.0-py3-none-any.whl |
Total release size: 1.2 MB
Release files / raggae-0.3.0.tar.gz
| Download URL | raggae-0.3.0.tar.gz |
|---|---|
| Size | 984.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8e46e30ffed0e0449e6814a93c51f3a71e0875eab1cea8bf4e3610ac37d8c37
|
|
BLAKE2b-256 checksum How to use checksums |
f6029a63a50065f8c7ce7724ef5277c5b5b91dfcb9547db2e059026ba1ec784c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logRelease files / raggae-0.3.0-py3-none-any.whl
| Download URL | raggae-0.3.0-py3-none-any.whl |
|---|---|
| Size | 195.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
984be0cc7f658432df3bdff571bb949527d6e0cffc84e8e216a7eb65656ddfdd
|
|
BLAKE2b-256 checksum How to use checksums |
835c30c17d04726776092e0f3e120c29680f729406318e9e32fc1b870a8dc20c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logSecurity for raggae 0.3.0
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 raggae-0.3.0.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 Oct 31, 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.