Skip to main content

Crate ragdrift_core

Crate ragdrift_core 

Source
Expand description

ragdrift-core: five-dimensional drift detection for production RAG systems.

This crate exposes detectors for data, embedding, response, confidence, and query-pattern drift, plus the underlying statistical primitives (KS, PSI, MMD, sliced Wasserstein). All numerics live here; the Python ragdrift package is a thin PyO3 wrapper.

§Example

use ndarray::Array2;
use ragdrift_core::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);

Re-exports§

pub use error::RagDriftError;
pub use types::BaselineSnapshot;
pub use types::DriftDimension;
pub use types::DriftReport;
pub use types::DriftScore;

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.

Type Aliases§

Result
Result alias used across the crate.