Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/evaltrust/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def audit(
run_aware: bool = False,
run_aware_future_runs: int | None = None,
correction: str = "bonferroni",
# --- efficiency (advisory; absent when not supplied) ---
token_count_data: "EvalData | None" = None,
latency_data: "EvalData | None" = None,
latency_unit: str = "ms",
# --- config passthrough (takes precedence over loose kwargs) ---
config: "AuditConfig | None" = None,
) -> AuditReport:
Expand Down Expand Up @@ -83,6 +87,19 @@ def audit(
correction:
Multiple-comparison correction for suite audits: ``"bonferroni"``,
``"holm"``, or ``"none"`` (default ``"bonferroni"``).
token_count_data:
Optional :class:`EvalData` whose ``scores`` carry per-example token
counts for the same two models. When supplied, an advisory
``Efficiency`` finding is added that shows the token-count ratio
alongside the quality delta. Does not change the verdict level.
latency_data:
Optional :class:`EvalData` whose ``scores`` carry per-example latency
values for the same two models. When supplied, an advisory
``Efficiency`` finding is added. Does not change the verdict level.
latency_unit:
Unit label for latency values (default ``"ms"``). Pass ``"s"`` if
the caller stores seconds, ``"us"`` for microseconds, etc. Used
verbatim in the finding text so the output always matches the data.
config:
A fully built :class:`AuditConfig`. When supplied, all loose statistical
kwargs above are ignored and the config is used directly.
Expand All @@ -103,7 +120,9 @@ def audit(
correction=correction,
)

kw = dict(config=config, threshold=threshold, slice_by=slice_by)
kw = dict(config=config, threshold=threshold, slice_by=slice_by,
token_count_data=token_count_data, latency_data=latency_data,
latency_unit=latency_unit)

if isinstance(source, EvalData):
return run_audit(source, model_a=model_a, model_b=model_b, **kw)
Expand Down
Loading