from poma import PrimeCutPrimeCut is the main synchronous client for new SDK integrations.
Constructor
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
submit(
file_path,
*,
base_url: str | None = None,
show_progress: bool = False,
eco: bool = False,
) -> strSubmit a document and return the job ID.
show_progress is accepted for compatibility and ignored.
Set eco=True to target the eco ingestion endpoints without switching methods.
collect
collect(
job_id: str,
*,
show_progress: bool = False,
initial_delay: float = 5.0,
poll_interval: float = 3.0,
max_interval: float = 15.0,
download_dir = None,
filename: str | None = None,
) -> PomaResultCollect a submitted job and return typed PomaResult.
collect(...) tries the status SSE stream first and falls back to adaptive polling if streaming is unavailable.
submit_eco
submit_eco(
file_path,
*,
base_url: str | None = None,
) -> strDeprecated alias for submit(..., eco=True).
poll
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,
) -> PomaArchiveDeprecated polling helper. It skips SSE and returns PomaArchive instead of PomaResult.
ingest
ingest(
file_path,
*,
base_url: str | None = None,
initial_delay: float = 5.0,
sse: bool | None = None,
poll_interval: float = 3.0,
max_interval: float = 15.0,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
) -> PomaResultSubmit, collect, download, and unpack in one call.
ingest_eco
ingest_eco(
file_path,
*,
base_url: str | None = None,
initial_delay: float = 5.0,
sse: bool | None = None,
poll_interval: float = 3.0,
max_interval: float = 15.0,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
) -> PomaResultRun the same flow against the eco endpoints.
Passing sse=False is still supported, but it is deprecated because collect() now chooses the transport automatically.
read_status_sse
read_status_sse(
job_id: str,
*,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
) -> PomaArchiveDeprecated low-level SSE helper.
handle_job_status
handle_job_status(
job_id: str,
status_data: dict[str, Any],
*,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
) -> PomaArchive | StateProcessing | StatePendingDeprecated low-level status parser kept for compatibility.
create_cheatsheet
create_cheatsheet(
relevant_chunksets: list[dict[str, Any]],
all_chunks: list[dict[str, Any]],
) -> strDeprecated helper. Use generate_cheatsheets(...) and read the first item's content.
create_cheatsheets
create_cheatsheets(
relevant_chunksets: list[dict[str, Any]],
all_chunks: list[dict[str, Any]],
) -> list[dict[str, Any]]Deprecated helper. Use the top-level generate_cheatsheets(...).
close
Close the underlying httpx.Client.
PrimeCut also supports context-manager usage:
with PrimeCut() as client:
result = client.ingest("example.pdf")For asyncio apps, use AsyncPrimeCut.