Skip to content

attachments 1.0.0

Choose a tag to compare

@github-actions github-actions released this 13 Oct 13:29
· 14 commits to main since this release

attachments 1.0: pip install attachments now installs this version (it
installed 0.25 until today). 1.0 is a complete rewrite with a new API —
coming from 0.25, read docs/MIGRATION.md; to stay on
0.25, pin attachments<1. The changes since 1.0.0b8:

Added

  • LightOnOCR-3 as the OCR engine of a server (ocr_engine: lighton,
    ATTACHMENTS_LIGHTON_URL). Default model lightonai/LightOnOCR-3-0.8B
    (was LightOnOCR-2-1B), read the way LightOn's published benchmark reads
    it: pages up to 5 megapixels, grounding mode with running headers,
    footers and page numbers left out, temperature 0.1 with a fixed seed. On
    olmOCR-bench (1,403 pages, measured on an RTX 3090) attachments scores
    82.8 with it, 39.7 with RapidOCR; on scanned pages 64 % against 20 %.
    Pages it cannot read (the endpoint down, an error, a page it never
    finishes) are read by RapidOCR when installed, page by page, listed in
    meta.extra.ocr_fallback_pages with a warning, instead of failing the
    file. The endpoint can be a unix socket (unix:/path/to/vllm.sock), for
    servers whose sandbox allows no local address. No new dependency: the
    client is the standard library.

  • configure(ocr_engine=...) / ATTACHMENTS_OCR_ENGINE: the engine for
    requests that name none. A server with LightOnOCR sets it to lighton;
    without an endpoint it quietly stays RapidOCR.

  • a.lm15(): one ready lm15.Message (typed text and image parts, each
    page's pictures after its text, same sources= / interleave= options
    as claude()), for every provider lm15 speaks; also
    attachments.to_lm15_message. New extra: attachments[lm15].

  • Labels on pictures (watermark:, back from 0.25, redone): page
    writes "page 3", "slide 3" or "sheet Sales" in a white strip above each
    picture; name adds the file name; any other text is drawn as written,
    with {name} and {page} filled in. Never over the content; the picture
    keeps its size (max_dim stays true); JPEG stays JPEG. Every format that
    makes pictures (PDF, Office, images, SVG, web screenshots, notebooks),
    read here or by the service. Off by default. 0.25's
    text|position|style draws the text, with a warning.

  • Specialized processors: @processor(".pdf", name="invoice", detect=...) adds a processor next to the standard one of a format,
    chosen by [processor: invoice] or by its detect; a base parameter
    receives the standard processing (base(), base(pages="1-2")). Its own
    options join the standard ones, att.options(".pdf") lists it, and
    meta.extra.processor says which ran.

  • The MCP tool marks pages and returns long results in parts. A
    [page N] ([slide N], [sheet Name]) line starts each page; at most
    16,000 characters come back per call (the agent may lower it with
    max_chars, not raise it; ATTACHMENTS_MCP_MAX_CHARS sets it for the
    server, 0 = no limit), cut where a page starts, with a --- more --- note: what was shown, start= for
    the rest, the pages option to jump. Clients cut longer results in the
    middle without a word (Pi past 20 KB): on a 40-page PDF, page 27 never
    reached the agent (evals/bench, mcp_pdf: GPT-6 Luna 0/3).

  • Private keys are recognised by their content. A file that starts
    like a private key (PEM, OpenSSH, PGP, PuTTY) is skipped in folders,
    archives and repositories, and never attached from a prompt, whatever its
    name (deploy_key, server.txt); ignore: "!name" keeps it.

  • missing_part() and lacks_dependency() (public): a processor that
    cannot make a requested part keeps the text and says why; core asks the
    service for the whole file when one is configured.

Changed

  • Pictures never cost a file its text. images: true on Word,
    PowerPoint or Excel without LibreOffice (or with LibreOffice failing on
    the file), screenshot: true without Chromium, images: true on an SVG
    without cairosvg: the file used to be a missing-dependency error, its
    text lost; now the text is read and a warning names what to install.
    A whole folder read with images: true no longer fails its Office files
    (evals/bench, folder). With a service configured, it is still asked
    for the pictures; if it fails, the text read here is kept.
  • images: true on a PDF with no page renderer (PyMuPDF, pdf2image) says
    so in a warning; the pictures used to vanish without a word.
  • The image and heic extras need Pillow 10.1 (its sized default font
    draws the labels).

Fixed

  • PDFs printed nothing on standard output: PyMuPDF 1.27+ prints an advert
    for its layout package from the table finder, which broke
    att --json > file.