python
from poma import AsyncPrimeCutAsyncPrimeCut is the asynchronous companion to PrimeCut.
Constructor
python
AsyncPrimeCut(
api_key: str | None = None,
*,
timeout: float = 600.0,
client: httpx.AsyncClient | None = None,
)If api_key is omitted, the client reads POMA_API_KEY.
Methods
submit
python
await submit(
file_path,
*,
base_url: str | None = None,
eco: bool = False,
) -> strSubmit a document and return the job ID.
collect
python
await 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.
Like the sync client, collect(...) tries SSE first and falls back to adaptive polling if needed.
ingest
python
await ingest(
file_path,
*,
base_url: str | None = None,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
initial_delay: float = 5.0,
poll_interval: float = 3.0,
max_interval: float = 15.0,
) -> PomaResultSubmit, collect, download, and unpack in one call.
ingest_eco
python
await ingest_eco(
file_path,
*,
base_url: str | None = None,
show_progress: bool = False,
download_dir = None,
filename: str | None = None,
initial_delay: float = 5.0,
poll_interval: float = 3.0,
max_interval: float = 15.0,
) -> PomaResultRun the same flow against the eco endpoints.
aclose
Close the underlying httpx.AsyncClient.
AsyncPrimeCut also supports async context-manager usage:
python
from poma import AsyncPrimeCut
async with AsyncPrimeCut() as client:
result = await client.ingest("example.pdf")