The-Vibe-Company/megaparse
File Parser optimised for LLM Ingestion with no loss 🧠 Parse PDFs, Docx, PPTx in a format that is ideal for LLMs.
MegaParse – AI‑powered document parser
What it is – MegaParse is an open‑source Python library that extracts structured content from many document formats (PDF, PowerPoint, Word, Excel, CSV, plain text). It can optionally use large‑language‑model vision APIs (e.g., OpenAI gpt‑4o, Anthropic Claude 3.5/4) to read images, tables, headers, footers, and other visual elements without losing information.
Why it matters – Turning unstructured files into clean, machine‑readable data is a bottleneck for downstream AI pipelines (retrieval‑augmented generation, knowledge bases, analytics). MegaParse aims to do this fast, with high fidelity, and with a simple Python interface.
Key features
- Multi‑format support – Text, PDF, PowerPoint, Word, Excel, CSV.
- Rich content extraction – Tables, table of contents, headers/footers, images.
- Low information loss – Designed to keep every element from the source file.
- LLM‑enhanced vision mode – Uses multimodal models (gpt‑4o, Claude 3.5/4) to interpret images and complex layouts.
- Fast & efficient – Built on Python 3.11+, leverages native tools like
popplerandtesseractfor OCR. - Open source – Available on PyPI under an open licence.
Quick start
# 1️⃣ Install the package (Python ≥3.11)
pip install megaparse
# 2️⃣ System dependencies (once per machine)
# - poppler (PDF rendering)
# - tesseract (OCR for images/PDFs)
# - libmagic (macOS only) → brew install libmagic
Create a .env file with your OpenAI or Anthropic API key.
Basic usage (plain parser)
from megaparse import MegaParse
parser = MegaParse()
result = parser.load("./example.pdf")
print(result) # JSON‑like structure with text, tables, images, etc.
Vision‑enhanced parsing (LLM‑driven)
import os
from megaparse.parser.megaparse_vision import MegaParseVision
from langchain_openai import ChatOpenAI
model = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"))
vision_parser = MegaParseVision(model=model)
structured = vision_parser.convert("./example.pdf")
print(structured)
Works with any multimodal model that can accept image inputs (Claude 3.5/4, gpt‑4o, etc.).
API mode
A small FastAPI server is bundled. Run the development server with:
make dev # launches http://localhost:8000
Visit /docs for OpenAPI documentation of the available endpoints (upload file, get parsed JSON, etc.).
Benchmark snapshot
| Parser | Similarity ratio |
|---|---|
| megaparse_vision | 0.87 |
| unstructured_with_check_table | 0.77 |
| unstructured | 0.59 |
| llama_parser | 0.33 |
| Higher scores indicate closer alignment with a ground‑truth reference. |
Roadmap (in‑progress)
- Better table validation and post‑processing modules.
- Modular “checkers” for custom cleanup steps.
- Structured output formats to enable direct interaction with downstream AI agents.
Who might use it?
- Data engineers building pipelines that ingest corporate documents.
- RAG developers needing high‑quality chunking of PDFs, slides, and spreadsheets.
- Researchers who want a reproducible, open‑source alternative to commercial document‑parsing SaaS.
- Product teams building AI assistants that must understand internal knowledge bases.
Where to find more
- Repository: https://github.com/QuivrHQ/MegaParse
- PyPI package:
megaparse - Star‑history chart and issue tracker are public for community contributions.
Related
- Project
- Project
- Project
- Project