Skip to main content

Crate ragdrift

Crate ragdrift 

Source
Expand description

ragdrift — five-dimensional drift detection for production RAG systems.

This crate is a thin re-export of ragdrift_core. It exists so that Rust users can write cargo add ragdrift and get the canonical entry point without remembering the -core suffix. There is no behavior or API here that isn’t already in ragdrift-core; pin whichever crate you prefer and the version will track.

For the Python wheel, see https://pypi.org/project/ragdrift/.

§Quick example

use ndarray::Array2;
use ragdrift::detectors::EmbeddingDriftDetector;

let baseline = Array2::<f32>::zeros((50, 16));
let mut current = Array2::<f32>::zeros((50, 16));
current += 1.0;

let detector = EmbeddingDriftDetector::new(0.1);
let score = detector.detect(baseline.view(), current.view()).unwrap();
assert!(score.score > 0.0);

Modules§

detectors
The five drift detectors. Each is a lightweight struct configured once and invoked many times — the cost is in the sample data, not the detector.
error
Error type returned by all fallible ragdrift operations.
stats
Statistical primitives used by the detectors. Each lives in its own submodule and is unit-tested independently.
types
Public data types: dimensions, scores, reports, baseline snapshots.

Structs§

BaselineSnapshot
A captured baseline used as the reference distribution for future detection.
DriftReport
A unified report aggregating per-dimension scores.
DriftScore
A single per-dimension drift measurement.

Enums§

DriftDimension
The five drift dimensions ragdrift monitors.
RagDriftError
All errors raised by the core crate.

Type Aliases§

Result
Result alias used across the crate.