Skip to main content

DEPRECATED: superseded by anchorite (https://github.com/populationgenomics/anchorite) >= 0.4.0

Project description

groundmark

[!WARNING] groundmark is deprecated and this repository is being archived.

Its citation-resolution API has been subsumed by anchorite >= 0.4.0, which exposes a very similar API. Note that anchorite is not batteries-included: the PDF-to-Markdown / pydantic-ai layer is left to the caller. See flowa for an example client that wires this together.

No further releases of groundmark will be made on PyPI. Existing versions remain installable, but importing groundmark will emit a DeprecationWarning.

groundmark

PDF to Markdown conversion and quote-to-bbox resolution.

What it does

  1. Convert: Send PDF pages to a vision-capable LLM (via Pydantic AI) to produce clean Markdown with <!--page--> markers between pages.
  2. Resolve: Given verbatim quote strings, locate them in the source PDF and return bounding box coordinates. Uses pypdfium2 for per-character bbox extraction and seq-smith for Smith-Waterman alignment.

Quick Start

import asyncio
from groundmark import DocumentIndex
from groundmark.convert import Config, ModelConfig, convert

async def main():
    pdf_bytes = open("document.pdf", "rb").read()

    # PDF -> Markdown (requires pydantic-ai, install with e.g. groundmark[bedrock])
    model = ModelConfig(name="bedrock:au.anthropic.claude-sonnet-4-6")
    result = await convert(pdf_bytes, Config(model=model))
    print(result.markdown[:500])

    # Resolve verbatim quotes to PDF bounding boxes
    doc = DocumentIndex(pdf_bytes)
    resolved = doc.resolve(["the patient presented with"])
    # -> {"the patient presented with": [(page, BBox(top, left, bottom, right)), ...]}

    # The DocumentIndex can be reused for multiple resolve calls against the same PDF
    more = doc.resolve(["another quote from the same paper"])

if __name__ == "__main__":
    asyncio.run(main())

Installation

# Resolve only (no LLM dependencies)
uv add groundmark

# With LLM provider extra(s) for conversion
uv add groundmark --extra anthropic,bedrock,google,openai

Configuration

Timeouts

The LLM call for PDF-to-Markdown conversion can take several minutes for large documents, especially with Opus on Bedrock. Timeout defaults by provider:

Provider Default Environment Variable
Bedrock (boto3) 300s AWS_READ_TIMEOUT
Anthropic (httpx) 600s — (use ModelSettings(timeout=...))

For Bedrock with Opus, 300s may not be enough. Set a higher timeout:

export AWS_READ_TIMEOUT=600

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

groundmark-0.6.0.tar.gz (212.6 kB view details)

Uploaded Source

Built Distribution

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

groundmark-0.6.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file groundmark-0.6.0.tar.gz.

File metadata

  • Download URL: groundmark-0.6.0.tar.gz
  • Upload date:
  • Size: 212.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for groundmark-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d46fbe112247fb2d530c5c2425c327e770746f80a8bf2bdda9cad69f4743bb76
MD5 a82139548caf9c00d67d72a88a9c98af
BLAKE2b-256 3aa6e2e62fd31687940ad52c6815a018a9430b9b39cd111b3282887b313cc746

See more details on using hashes here.

Provenance

The following attestation bundles were made for groundmark-0.6.0.tar.gz:

Publisher: release.yaml on populationgenomics/groundmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file groundmark-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: groundmark-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for groundmark-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c014d062dd523bd10ef662afcf48c4d6d74093243416ffc2061ff2a275e32cd5
MD5 5f0a8915719965486b6fa1d9ae3ecd3a
BLAKE2b-256 37f5c9e3ada975973525e30bb52c66723fedf06a4c95f7007e43ce4a53229501

See more details on using hashes here.

Provenance

The following attestation bundles were made for groundmark-0.6.0-py3-none-any.whl:

Publisher: release.yaml on populationgenomics/groundmark

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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