EverAlgo parser: multimodal raw-file parsing (image / audio / document / video / url) into ParsedContent.
Project description
everalgo-parser
Multimodal parsing — image / audio / document / video / url raw inputs into ParsedContent. Used by everalgo-knowledge for file ingestion and by EverOS step 1 for inline parsing.
See the umbrella project: EverAlgo monorepo and the architecture document at docs/concepts/architecture.md.
Quick start
from everalgo.llm.config import LLMConfig
from everalgo.llm.providers.openai_compat import OpenAICompatClient
from everalgo.parser import aparse, RawFile
# Create an LLM client per call (or share one instance). The parser uses
# OpenAI-compatible clients; OpenRouter is the reference deployment
# (Gemini multimodal via OpenRouter passthrough).
client = OpenAICompatClient(LLMConfig(
model="google/gemini-3-flash-preview",
api_key="sk-or-v1-...",
base_url="https://openrouter.ai/api/v1",
))
# Bytes-in: caller already hydrated the file.
parsed = await aparse(RawFile(content=pdf_bytes, extension="pdf"), llm=client)
print(parsed.text)
# URL-in: parser fetches over HTTP, then delegates to the HTML handler.
parsed = await aparse(RawFile(uri="https://example.com/article"), llm=client)
print(parsed.metadata["title"], parsed.text[:500])
Supported formats
| Modality | Extensions | Backend |
|---|---|---|
PDF |
pdf |
Multimodal LLM (single call, full doc) |
IMAGE |
png / jpg / jpeg / webp / bmp / tiff / tif / svg |
Multimodal LLM; BMP/TIFF transcoded to PNG via Pillow; SVG rasterised via cairosvg; tall screenshots split + merged |
AUDIO |
mp3 / wav / m4a / amr / aiff / aac / ogg / flac |
Multimodal LLM ASR |
HTML |
html / htm |
bs4 cleanup → LLM extraction |
EMAIL |
eml |
stdlib email + inline-image OCR via the LLM |
DOCUMENT |
docx / pptx / xlsx / doc / ppt / xls / pages / key / numbers / odt / ods / odp / rtf |
LibreOffice soffice --convert-to pdf → reuse PDF path |
URL |
(any http/https URI) |
httpx fetch → HTML handler |
DIRECT |
txt / md / csv / tsv / vtt |
UTF-8 decode, no LLM |
VIDEO |
— | Deferred (no upstream implementation; ADR pending) |
Installation
pip install everalgo-parser # core: pdf / image / audio / html / eml / direct / url
pip install 'everalgo-parser[svg]' # adds SVG support (cairosvg)
System dependency for Office documents
Office document parsing (docx / xlsx / pptx / …) shells out to LibreOffice, which is a system package, not a pip wheel. Install before parsing Office files:
# Ubuntu / Debian
sudo apt-get install -y libreoffice
# macOS
brew install --cask libreoffice
The parser detects soffice via shutil.which("soffice") and the canonical macOS Applications path. Missing → RuntimeError with install instructions when an Office file is parsed; non-Office paths are unaffected.
Conventions
aparse(...)is async;parse(...)is the sync bridge viaasgiref.async_to_sync.- Prompts live as module-level string constants under
prompts/{en,zh}/<operator>.py(AGENTS.md §5). Swap languages by re-binding the constant at startup. - The library is stateless: it never reads the filesystem and never owns business state. HTTP I/O (LLM calls, URL fetching) is explicitly allowed.
- No retry / fallback / metrics inside operators — surface failures via
LLMError, let the caller wrap.
Security notes for callers
everalgo-parser is a stateless library; production safety properties belong to the calling service. The points below are easy to miss and worth wiring into your integration:
- SSRF —
url.aparsefetches arbitrary HTTP(S) URIs.fetch_urirejects non-http(s) schemes (nofile://, nogopher://) but does not block private / link-local / loopback IPs (e.g.127.0.0.1,10.0.0.0/8,169.254.169.254cloud metadata, IPv6 ULA). If callers may pass attacker-controlled URLs, resolve the hostname first and reject private ranges before invokingaparse, or front the parser with an egress proxy that does the filtering. - Decompression-bomb cap is set at import time.
everalgo/parser/__init__.pypinsPIL.Image.MAX_IMAGE_PIXELS = 100_000_000(10000×10000) — Pillow will raiseDecompressionBombErrorabove that. Re-assign after import if your workload genuinely needs larger images. - Office conversion runs LibreOffice as a subprocess.
document._convert_to_pdf_via_sofficevalidates theextensionparameter (alphanumeric, ≤8 chars) before writing the temp file, but the LibreOffice attack surface itself is large. Run the host with a non-root user and treat untrusted office docs as you would any other complex binary input. cairosvg(optional[svg]extra) is LGPL-3.0-or-later. EverAlgo itself is Apache-2.0. LGPLv3 is compatible with Apache-2.0 whencairosvgis consumed as an unmodified library through its public Python API (which is what the SVG path does); if you statically vendor or modifycairosvg, LGPLv3 §4 / §5 obligations apply to that derivative. Not installing the[svg]extra removes the dependency entirely.
Reference
- Architecture (definitive):
docs/concepts/architecture.md - Schema source for PDF / image / audio / document / html / email: upstream internal multimodal parser library (snapshot
prod-20260306-0331-v1). - Schema source for URL metadata extraction: upstream internal URL extractor reference implementation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file everalgo_parser-0.2.1.tar.gz.
File metadata
- Download URL: everalgo_parser-0.2.1.tar.gz
- Upload date:
- Size: 686.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fec4d4c5743514a2cdbf756a34bc6ef987ea7503082768a8d6d764032a78992
|
|
| MD5 |
a4b40baed620085633b2f0a22c18666c
|
|
| BLAKE2b-256 |
26142f54d4c108ad5b5be1ac0efb7ada9b2ee2cc1802018d9141ffc7fea939e4
|
File details
Details for the file everalgo_parser-0.2.1-py3-none-any.whl.
File metadata
- Download URL: everalgo_parser-0.2.1-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3876c898d835e2ae4e3bd7f2f61585de9ff84c13da54f7bbd658f795f8df007f
|
|
| MD5 |
d9ed74aedaea263fa79c240397ca3795
|
|
| BLAKE2b-256 |
3f6d0a79a847e48d4417846916229ad90b0f13e7d348f31c84af30f31a7e0607
|