Expand description
Pure-Rust core for ragdrift.
This crate computes drift scores between a baseline and a current sample across five dimensions used in RAG monitoring: data, embedding, response, confidence, and query-pattern.
The crate is split into two layers:
statsholds the underlying statistical primitives (Kolmogorov-Smirnov, PSI, MMD, Wasserstein).detectorscomposes the primitives into batch detectors that take baseline and current samples and return aDriftScore.
use ndarray::Array1;
use ragdrift_core::detectors::ConfidenceDriftDetector;
let baseline = Array1::from(vec![0.9, 0.85, 0.92, 0.88, 0.91]);
let current = Array1::from(vec![0.6, 0.55, 0.62, 0.58, 0.61]);
let detector = ConfidenceDriftDetector::default();
let score = detector.detect(&baseline.view(), ¤t.view()).unwrap();
assert!(score.exceeded);Re-exports§
pub use error::RagDriftError;pub use error::Result;pub use types::BaselineSnapshot;pub use types::DriftDimension;pub use types::DriftReport;pub use types::DriftScore;