SDK
Python SDK
The Python SDK is suited for data pipelines, evaluation harnesses, and backend services.
Client setup
Use one reusable client instance and avoid constructing clients inside hot loops.
from aletheia import AletheiaClient
client = AletheiaClient(
base_url="http://127.0.0.1:3000",
api_key="XXX1111AAA",
timeout_s=10,
)Batch ingest pattern
For very large batches, parallelize by entity partition to reduce lock contention and preserve ordering semantics within each session.
batch = [
{"entity_id": "user-123", "textual_content": "I moved to LA."},
{"entity_id": "user-123", "textual_content": "I now prefer tea."},
]
for item in batch:
client.ingest(**item)Evaluation usage
- Keep deterministic seeds for benchmark comparability.
- Record model and policy versions in run metadata.
- Persist raw hit lists, not only aggregate metrics.