Skip to main content

driftvane

CI Python License: MIT

Compose drift detectors for RAG and agent systems.

Most drift libraries are either tabular-only (Evidently, DataDrift) or are platforms that want you to ship telemetry to their backend (Phoenix, Arize). driftvane is a small Python library that lets you wire up multiple drift signals — embedding, retrieval, response, latency — into one report. No server, no UI, no telemetry. Plug it into a Lambda or Glue job, get a pandas.DataFrame or a JSON dict back.

Install

pip install driftvane
# optional
pip install "driftvane[pandas]"            # to_pandas()
pip install "driftvane[external-response]" # delegate response scoring to context-drift-detector-py

Quickstart

import numpy as np
from driftvane import (
    DriftReport,
    EmbeddingDrift,
    RetrievalDrift,
    ResponseDrift,
    LatencyDrift,
)
from driftvane.detectors.response import Triple

ref_emb = np.load("reference_query_embeddings.npy")  # (n, 768)
cur_emb = np.load("current_query_embeddings.npy")

report = DriftReport.from_signals([
    EmbeddingDrift(threshold=0.1).compute(ref_emb, cur_emb),
    RetrievalDrift(k=10, threshold=0.3).compute(ref_top_k, cur_top_k),
    ResponseDrift(threshold=0.15).compute(ref_triples, cur_triples),
    LatencyDrift(p_threshold=0.01).compute(ref_latencies, cur_latencies),
])

if report.any_drifted():
    print(report.to_pandas())

Or fail a CI job when retrieval moves too much:

from driftvane import DriftAlert

try:
    report.alert_if({"retrieval_jaccard_at_10": 0.2})
except DriftAlert as e:
    sys.exit(f"drift gate failed: {e}")

Detectors

Detector Input Statistic Notes
EmbeddingDrift two (n, d) arrays MMD with RBF kernel, median-heuristic sigma numpy-only, O(n²) — subsample for n > a few thousand
RetrievalDrift paired top-k id lists 1 − mean Jaccard@k; reports RBO too aligned queries required
ResponseDrift (intent, context, answer) triples shift in mean answer-to-context grounding uses context-drift-detector-py if installed
LatencyDrift two 1-D arrays of floats Kolmogorov–Smirnov D + asymptotic p-value scipy-free

Each detector returns a DriftSignal(name, value, threshold, drifted, metadata). DriftReport collects them.

What it does NOT do

  • No server. No UI. No telemetry shipping.
  • No tabular feature drift — use DataDrift for KS/PSI on classical features.
  • No live trace ingestion or OTel collection — point this at parquet/numpy arrays you already have.
  • No causal root-cause analysis. It tells you that drift is there, not why.
  • No model retraining triggers — emit your own when report.any_drifted().

Why not Phoenix / Arize / Evidently / Ragas?

driftvane Phoenix Arize Evidently Ragas
Library-only (no server) ✓ ✗ ✗ partial ✓
RAG-shaped detectors ✓ ✓ ✓ ✗ ✓
Embedding MMD out of the box ✓ partial ✓ ✗ ✗
Retrieval rank-shift ✓ ✗ partial ✗ ✗
Run inside a 5s Lambda ✓ ✗ ✗ ✓ partial
numpy-only core deps ✓ ✗ ✗ ✗ ✗

Status

v0.1 — alpha. The four detectors above work and have tests. Public API may change before v1.0. Issues and PRs welcome.

Metadata

Release files for driftvane 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for driftvane 0.1.0
File Size Uploaded Provenance
driftvane-0.1.0.tar.gz 12.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for driftvane 0.1.0
File Interpreter ABI Platform
driftvane-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / driftvane-0.1.0.tar.gz

Download URL driftvane-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0f141d9e7b73e8d1b8f1edcc6bdbe9866c3593a9dd43d109a8315d0da1bbca7d
BLAKE2b-256 checksum
How to use checksums
2e5f861d06aafbde44e9b5989ea1e6c6c217d89f72e2875f749b001bdcc4658d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / driftvane-0.1.0-py3-none-any.whl

Download URL driftvane-0.1.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccf100efab722e95bbd7c3d7353d2893508da97ecdbf3c6b134a1b1308831a94
BLAKE2b-256 checksum
How to use checksums
60d1f5ad387168193114dbdcc2a55b2681db0c11fab901e7e675b7c8cb098ee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for driftvane 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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