Skip to main content

z-parser

Python SDK for the z-parser document-extraction service: bytes in, RAG-ready Markdown out. Scanned PDFs (SOTA OCR + vision escalation), Office, spreadsheets, images, charts, manuscripts, EPUB, e-mail, audio/video transcription — one client.

pip install z-parser-sdk       # the import stays `z_parser`, the CLI stays `z-parser`
from z_parser import ZParser

zp = ZParser("http://localhost:4056")     # or export Z_PARSER_URL
doc = zp.parse("rapport.pdf")             # path, or bytes + filename=
print(doc.parser, doc.num_chars)          # e.g. "mistral-ocr+figures(2)" 48213
doc.save("rapport.md")

pdf = zp.render_pdf("deck.pptx")          # Office → viewable PDF (page N = slide N)
figs = zp.images("catalogue.pdf", mode="artwork")   # per-figure crops + captions

CLI:

z-parser contract.pdf -o contract.md

Pick your provider and quality levers from the client — Mistral, Ollama (100 % local), vLLM, Hugging Face, Gemini or any OpenAI-compatible vision endpoint, per client or per call:

# Mistral vision in one word (openai dialect on api.mistral.ai, server key applies)
zp = ZParser(vision_provider="mistral", vision_model="mistral-small-latest")

# 100 % local with Ollama — no data leaves your machine
zp = ZParser(vision_provider="openai",
             vision_base_url="http://host.docker.internal:11434/v1",  # seen FROM the server
             vision_model="llama3.2-vision",
             doc_vision=True)      # PDFs through local vision too → fully offline

# Quality levers (mirror the server's .env):
doc = zp.parse("dossier.pdf",
               ocr_escalate=True,       # weak OCR pages re-read by vision (manuscripts)
               describe_figures=True)   # embedded charts/diagrams described on their page

One runnable example per provider ships in examples/ (with sample files), plus 09_formats_sweep.py — a QA battery (PDF, image, Excel, HTML, XML, LaTeX, CSV) that checks Markdown structure and writes a browsable results/ gallery. Safety contract: a caller-chosen vision_base_url never receives the server's own API keys (api_key is an alias for vision_api_key). With no params, the server's configuration applies.

Errors are explicit: ZParserError carries the service's status (unsupported / error) and message. Timeouts default to 15 minutes — large OCR jobs are slow by nature; pass timeout= to change.

The service itself (Docker, one container) and its ground-truth benchmark live in the main repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

z_parser_sdk-1.1.1.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z_parser_sdk-1.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file z_parser_sdk-1.1.1.tar.gz.

File metadata

  • Download URL: z_parser_sdk-1.1.1.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for z_parser_sdk-1.1.1.tar.gz
Algorithm Hash digest
SHA256 9240e94e99b076e31a245b1aa8d28275591a1bfcd71bf05bb37276a3d61c18f6
MD5 863a4d62ebe16a557f048735b1c00646
BLAKE2b-256 6d4eeddcdfdff0aa49044ea9dab8f4f87a12b07ba09960ea39958820f875b1fa

See more details on using hashes here.

File details

Details for the file z_parser_sdk-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: z_parser_sdk-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for z_parser_sdk-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 770dd3bc4bb57c5b2c30d3dce2be6fff04e085508d71627d0618b55f5986b794
MD5 bd6f7066edd2709497bba4ae02ac32dd
BLAKE2b-256 cf8fdc68b223dfea0fe5e58ed9278ed804b77f9a6804c1ed354f2b614b95b189

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page