jev-curate with pip:
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.
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.
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
presetvalues raiseValueErrorduringPyJevCurator(...)initialization. filter_textraisesRuntimeErroronly on runtime/fatal errors; row-level evaluation errors (including Jev API/transport failures) return aCurateVerdictdictwithpassed=Falseand details inrejection_reasons.filter_fileraisesRuntimeErroron fatal I/O, dataset parsing, or runtime errors; per-row Jev evaluation failures are caught, counted undererrors, and written toerrors.jsonlrather than aborting the batch.