Skip to content
python
from poma import PrimeCut

PrimeCut is the main client for new SDK integrations.

Constructor

python
PrimeCut(
    api_key: str | None = None,
    *,
    timeout: float = 600.0,
    client: httpx.Client | None = None,
)

If api_key is omitted, the client reads POMA_API_KEY.

Methods

submit

python
submit(
    file_path,
    *,
    base_url: str | None = None,
    show_progress: bool = False,
) -> str

Submit a document and return the job ID.

poll

python
poll(
    job_id: str,
    *,
    initial_delay: float = 5.0,
    poll_interval: float = 3.0,
    max_interval: float = 15.0,
    show_progress: bool = False,
    download_dir = None,
    filename: str | None = None,
) -> PomaArchive

Poll a job until completion and return PomaArchive.

ingest

python
ingest(
    file_path,
    *,
    base_url: str | None = None,
    initial_delay: float = 5.0,
    poll_interval: float = 3.0,
    max_interval: float = 15.0,
    show_progress: bool = False,
    download_dir = None,
    filename: str | None = None,
) -> PomaResult

Submit, poll, download, and unpack in one call.

create_cheatsheet

python
create_cheatsheet(
    relevant_chunksets: list[dict[str, Any]],
    all_chunks: list[dict[str, Any]],
) -> str

Generate one cheatsheet for one document.

create_cheatsheets

python
create_cheatsheets(
    relevant_chunksets: list[dict[str, Any]],
    all_chunks: list[dict[str, Any]],
) -> list[dict[str, Any]]

Generate one cheatsheet per document across a mixed result set.

close

Close the underlying httpx.Client.

PrimeCut also supports context-manager usage:

python
with PrimeCut() as client:
    result = client.ingest("example.pdf")