Skip to main content

haic-metrics

haic-metrics is a standalone evaluation engine for Human–AI Collaboration (HAIC) systems.

It consumes a decisions artifact (produced by haic-logging or compatible instrumentation) and computes interaction-level KPIs that go beyond model-centric accuracy.


Design Principles

  • Decision-centric evaluation
    Metrics are computed from interaction decisions, not UI or backend logs.

  • Schema-tolerant by design
    Alias-aware normalization enables heterogeneous pilot adoption.

  • Profile-based evaluation
    Core metrics are always available; extended metrics are opt-in.


Installation

pip install haic-metrics

Input Contract

haic-metrics accepts either:

  • a list of decision dictionaries, or
  • a decisions artifact with key "decisions".

Minimal decision fields:

  • actor_type
  • action or event_type
  • t / timestamp
  • object_id

Optional fields unlock additional metrics:

  • duration_s
  • latency_ms
  • correct
  • labels / predictions

Quickstart

from haic_metrics import compute_metrics
from haic_metrics.io import load_decisions_artifact

artifact = load_decisions_artifact("haic_decisions_run123.json")

result = compute_metrics(artifact, profile="core")

print(result["metrics"])

Time-windowed evaluation

HAIC metrics can be computed over a specific temporal window of a session. This allows developers and researchers to evaluate only the relevant portion of an interaction (e.g., after model warm-up, during adaptation phases, or within fixed experimental intervals).

Two windowing modes are supported:

  • Relative window (offset from session start, in seconds)
  • Absolute window (ISO 8601 UTC timestamps)

If session-level timestamps are missing, the evaluator automatically falls back to the earliest recorded event timestamp.

Example

from haic_metrics import compute_metrics

result = compute_metrics(
    artifact,
    window={
        "basis": "relative",
        "start": 0,
        "end": 120,
    }
)

print(result["metrics"])
print(result["window_summary"])

The evaluation report always discloses the requested and effective window used for metric computation. This is high signal, low maintenance.


Reporting

The library includes a structured Markdown reporting module that generates self-describing evaluation reports, including:

  • Evaluation window disclosure
  • Metric summaries
  • Diagnostics and warnings
  • Reproducibility metadata (versions, timestamps)

Reports are designed for both experimental analysis and pilot documentation.

Evaluation Profiles

profile="core" (default)

Always computable from minimal decision logs.

Includes:

  • F: interaction frequency
  • D: average action duration
  • HCL: human-centeredness proxy
  • Tr: trust / quality proxy
  • A: adaptability
  • S: human–AI similarity
  • EL: effort / efficiency loss
  • EfficiencyScore
  • Human response-time summary (p50/p90/p95)
  • AI latency summary (p50/p90/p95)

profile="full"

Includes all core metrics plus outcome-based measures when sufficient labels are present:

  • accuracy
  • precision / recall
  • human–AI agreement
  • trust score proxies

Output Format

{
  "metrics": {
    "F": 0.42,
    "D": 1.8,
    "HCL": 0.63,
    "ai_latency_p90_ms": 180,
    ...
  },
  "warnings": [
    "decision[2] missing timestamp key"
  ]
}

Warnings are non-fatal and indicate partial data coverage.

What This Library Does NOT Do

  • It does not ingest raw application logs
  • It does not perform online evaluation
  • It does not assume any domain (radiology, energy, manufacturing)

Intended Usage Pattern

decisions.json
     └── haic-metrics
            └── metrics report

License

MIT


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haic_metrics-0.2.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haic_metrics-0.2.1-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file haic_metrics-0.2.1.tar.gz.

File metadata

  • Download URL: haic_metrics-0.2.1.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for haic_metrics-0.2.1.tar.gz
Algorithm Hash digest
SHA256 39eb73a701ba49c4b5289838cc8f32de56c26540602894d6e47d333d129447e5
MD5 d5d1882947cebdc9cc201526291fd8e9
BLAKE2b-256 8b4691537fc898409fc6a567705c4befad12b7ad410f5fcbd1f0fe23255eca14

See more details on using hashes here.

File details

Details for the file haic_metrics-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: haic_metrics-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for haic_metrics-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d20533ed9f5f03a950ab7dc7130efee299f2a72987150a815d887e62bbd6d14
MD5 dda52be31d6dc9c359f119a1b472004a
BLAKE2b-256 9969c04a4381acb79dd98eda2e6dce4b8175339c173629f53cd51727560ce153

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page