Official Python client for the Stratum document-chunking API.
Project description
stratum-client (Python)
Official Python client for the Stratum document-chunking API.
pip install stratum-client
Quick start
from stratum_client import Client, JobConfig
client = Client(api_key="stratum_xxxxxxxx_...") # or set STRATUM_API_KEY
job = client.submit_job(
"report.pdf",
config=JobConfig(target_size=500, enrichments=["summary"]),
)
result = client.wait_for_job(job.id)
for chunk in result["chunks"]:
print(chunk["text"])
Client
Client(
api_key: str | None = None, # falls back to $STRATUM_API_KEY
base_url: str = "https://api-stratum.pleias.dev",
timeout: float = 60.0,
)
Methods:
| Method | Description |
|---|---|
healthz() / readyz() |
Liveness / readiness probes |
submit_job(file, *, config=None, project_id=None) |
Upload a document and create a job |
get_job(job_id) |
Fetch a single job |
list_jobs(*, page=1, page_size=20, status=None, project_id=None) |
Paginated job list |
iter_jobs(*, page_size=50, status=None, project_id=None) |
Iterate every job, auto-paging |
get_job_result(job_id) |
Download the chunker output (dict matching docs/output-format.md) |
cancel_job(job_id) |
Delete a job and its storage artifacts |
wait_for_job(job_id, *, poll_interval=2.0, timeout=None) |
Poll until done; returns the result |
Client is also a context manager: with Client(...) as c: ....
Errors
All errors derive from StratumError:
AuthenticationError(401/403)NotFoundError(404)JobNotCompleteError(409 — result requested before job finished)ApiError(other non-2xx)JobFailedError(raised bywait_for_jobwhen the job ends infailed)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stratum_client-0.1.1.tar.gz.
File metadata
- Download URL: stratum_client-0.1.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35df0bb3f5ed7b9be60ed0d143646399d1a3c89d8319300b01e35f3b214017a
|
|
| MD5 |
d3de9b1dc259ee2a9d3ccd7c23820818
|
|
| BLAKE2b-256 |
d632a3bd024f37732f2baa4304e23f2a11ebe5156ec1fe3f2cfe8614724bc01b
|
Provenance
The following attestation bundles were made for stratum_client-0.1.1.tar.gz:
Publisher:
publish-python-client.yml on Pleias/stratum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stratum_client-0.1.1.tar.gz -
Subject digest:
a35df0bb3f5ed7b9be60ed0d143646399d1a3c89d8319300b01e35f3b214017a - Sigstore transparency entry: 1439910082
- Sigstore integration time:
-
Permalink:
Pleias/stratum@13e0f025e3ea1f7612745ba4283b8f8040267db4 -
Branch / Tag:
refs/tags/python-client-v0.1.1 - Owner: https://github.com/Pleias
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-client.yml@13e0f025e3ea1f7612745ba4283b8f8040267db4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stratum_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: stratum_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d84d1be62b5c608922162885911246e910c0db0d6895051b4741f7546dd274
|
|
| MD5 |
8d4e3ef6f1dea45fcca0f3464fc772cd
|
|
| BLAKE2b-256 |
a89950daf7e706dc19f46eb92920e05f22ec41895a141b4b415a49efff6450c4
|
Provenance
The following attestation bundles were made for stratum_client-0.1.1-py3-none-any.whl:
Publisher:
publish-python-client.yml on Pleias/stratum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stratum_client-0.1.1-py3-none-any.whl -
Subject digest:
51d84d1be62b5c608922162885911246e910c0db0d6895051b4741f7546dd274 - Sigstore transparency entry: 1439910112
- Sigstore integration time:
-
Permalink:
Pleias/stratum@13e0f025e3ea1f7612745ba4283b8f8040267db4 -
Branch / Tag:
refs/tags/python-client-v0.1.1 - Owner: https://github.com/Pleias
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-client.yml@13e0f025e3ea1f7612745ba4283b8f8040267db4 -
Trigger Event:
push
-
Statement type: