Skip to main content

Evaluation layer for gaptrace observability system

Project description

gaptrace-evaluate

Scores captured runs. Two tasks, one discovery helper:

Task Call Cost
"Is this run healthy?" check(run_id) free — deterministic, no LLM, instant
"Score it fully" evaluate(run_id) free input metrics + LLM-judged output metrics
"What can be scored?" available_metrics() free
pip install gaptrace-evaluate

Is this run healthy? — check()

Call before paying for an LLM; put it in CI.

import gaptrace_capture
from gaptrace_evaluate import check

run_id = gaptrace_capture.capture(
    "what is RRF?", "RRF fuses rankings.",
    chunks=[{"chunk_id": "c1", "source_doc_id": "d1",
             "content": "RRF combines rankings.", "token_count": 10,
             "rerank_score": 0.9}],
)
result = check(run_id)

print(result.verdict)      # "ok" | "warn" | "fail"
print(result.problems)     # ["duplicate chunks: ratio 0.50 exceeds 0.20", ...]
print(result.risk_score)   # 0.0-1.0, None if input quality couldn't be assessed
print(result.factors)      # per-factor {value, threshold, status}
print(result.thresholds)   # "learned" | "policy" — which standards were applied

check() compares all free input metrics against the current standards: once at least 10 evaluated runs exist for the pipeline it uses thresholds learned from your own history (and says so via thresholds == "learned"); before that it falls back to the policy defaults. A run captured without chunks gets a warn verdict explaining the missing data — never an exception.

Score it fully — evaluate()

import gaptrace_capture
from gaptrace_evaluate import evaluate

run_id = gaptrace_capture.capture(
    "what is RRF?", "RRF fuses rankings.",
    chunks=[{"chunk_id": "c1", "source_doc_id": "d1",
             "content": "RRF combines rankings.", "token_count": 10,
             "rerank_score": 0.9}],
)

# Complete eval: every metric applicable to the record.
result = evaluate(run_id)

# One atomic metric — nothing else is computed:
result = evaluate(run_id, metrics=["duplicates"], save=False)

# A chosen subset:
result = evaluate(run_id, metrics=["relevance", "faithfulness"])

target can be an sNrN string (what gaptrace_capture.capture() returns), a committed Capture object, or a bare RunRecord (then pass save=False — there's no run row to write to).

EvalResult

Field Meaning
metrics per-metric results: a dict of values for input families, a float for RAGAS metrics
skipped metric → reason: "not requested", "missing data: ...", or "requires ground_truth"
errors metric → error string; RAGAS-not-installed and RAGAS runtime failures land here identically — evaluate() never raises for judge failures
policy_violations policy thresholds breached by the computed values
risk_score None when input metrics weren't computed; 0.0 only ever means "computed, no risk"
run_id / saved identity and whether scores were persisted

save=True (default) persists via the one store path; gaptrace explain <run_id> then shows the scores alongside its analysis.

available_metrics()

Metric Layer Cost Requires
relevance input free chunks
duplicates input free chunks
truncation input free chunks
token_efficiency input free chunks
coherence input free chunks
faithfulness output llm chunks, response
answer_relevancy output llm chunks, response
context_precision output llm chunks, response
context_recall output llm chunks, response, ground_truth

Output metrics are RAGAS LLM-as-judge calls — they cost money and need a configured judge. To stay free-only, use check(), or select input metrics explicitly: evaluate(run_id, metrics=["relevance", "duplicates", "truncation", "token_efficiency", "coherence"]).

Policy system

Human-set thresholds encoding known failure modes; active from day one and the fallback standard for check(). Stored per pipeline.

gaptrace-evaluate policy show
gaptrace-evaluate policy set max_duplicate_ratio 0.1
gaptrace-evaluate policy reset

Programmatic override: evaluate(run_id, policy=InputQualityPolicy(...)).

Benchmark lifecycle (CLI)

Learned thresholds accumulate as you evaluate real runs — check() picks them up automatically at 10+ evaluated runs. The CLI exposes the machinery for inspection:

gaptrace-evaluate run s2r3                 # evaluate one run (both layers)
gaptrace-evaluate run s2r3 --input-only    # free metrics only
gaptrace-evaluate run --session s2         # evaluate a whole session
gaptrace-evaluate benchmark show           # current learned thresholds
gaptrace-evaluate benchmark build          # rebuild from evaluated history
gaptrace-evaluate benchmark check s2r3     # factor-by-factor threshold check
gaptrace-evaluate benchmark export         # RAGAS-compatible JSONL dataset

--input-only --output-only together is an error (it would compute nothing).

Project details


Download files

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

Source Distribution

gaptrace_evaluate-0.1.0.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

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

gaptrace_evaluate-0.1.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file gaptrace_evaluate-0.1.0.tar.gz.

File metadata

  • Download URL: gaptrace_evaluate-0.1.0.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaptrace_evaluate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f8561c1c40417bb0e0c0724a94a51587ef9dea98935c9d61c54df62a155af27
MD5 733cb995827e4399759fcdf2736bbc3e
BLAKE2b-256 1df69ec98452a5d053b83fe7887e5c2e929c7db58f6f8c58db10b17374b641e7

See more details on using hashes here.

File details

Details for the file gaptrace_evaluate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gaptrace_evaluate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gaptrace_evaluate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2df1d53ccf048c4139bdb009a4430d8f3f36527fe03873f249fccf41d60b5da3
MD5 b42aba7a5b72c9f19f272688d6f50daa
BLAKE2b-256 96ddd952021051b3c190a2c7182387555bbd3fc2c6ff009c0b5c99ad7ab09e68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page