Skip to main content
Install jev-curate with pip:
The Python package exposes PyJevCurator, a synchronous wrapper around the Rust CurateFilter pipeline and a single-threaded Tokio runtime.

Initialize PyJevCurator

Pass your TypeSafe API key and a preset name (or path to a .yaml/.json rubric file). You can optionally override the model or API endpoint.
If preset does not match a built-in preset or a valid rubric file, PyJevCurator raises ValueError. If the underlying Tokio runtime fails to initialize, it raises RuntimeError.

Filter a single string with filter_text

filter_text(text) runs host-side sanity checks, secret scanning, and the Jev API evaluation for one string, returning a CurateVerdict dict.
filter_text returns a CurateVerdict dict with four keys: filter_text raises RuntimeError only on runtime/fatal errors. On row-level evaluation errors (host sanity failure, secret_scan match, missing answers/confidence, or Jev evaluation/API failure), filter_text returns a CurateVerdict dict with passed=False and the reason recorded in rejection_reasons.

Filter a dataset file with filter_file

filter_file(input, out="./curated", dry_run=False) uses bounded streaming to read a .jsonl or .parquet file incrementally without accumulating output in memory, evaluates each row, and writes clean.jsonl, rejected.jsonl, and errors.jsonl to out.
Set dry_run=True to run host-side secret_scan and pre_filter_sanity checks locally with zero network calls. filter_file returns a dict with row counts:

Error handling

  • Invalid preset values raise ValueError during PyJevCurator(...) initialization.
  • filter_text raises RuntimeError only on runtime/fatal errors; row-level evaluation errors (including Jev API/transport failures) return a CurateVerdict dict with passed=False and details in rejection_reasons.
  • filter_file raises RuntimeError on fatal I/O, dataset parsing, or runtime errors; per-row Jev evaluation failures are caught, counted under errors, and written to errors.jsonl rather than aborting the batch.