Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8742a3e
adding assertion logic and updating evaluation error handling
thorrester Oct 22, 2025
f1ee0bb
regex pattern
thorrester Oct 22, 2025
892f035
adding assertion enums
thorrester Oct 23, 2025
641b4d3
adding actual comparisons
thorrester Oct 23, 2025
048cf1a
adding field assertion
thorrester Oct 23, 2025
c309a66
test assertsions
thorrester Oct 23, 2025
4331f2a
working on llm judge task
thorrester Oct 23, 2025
d34bdb6
better folder structure
thorrester Oct 23, 2025
6f62980
trying EvaluationRecord
thorrester Oct 24, 2025
43c15d4
Update types.rs
thorrester Oct 26, 2025
9d71d91
updating llmrecord struct
thorrester Oct 26, 2025
c5e2b70
adding migration for llm events
thorrester Oct 27, 2025
22ade32
updating types
thorrester Oct 27, 2025
e5ed9ca
refactor imports
thorrester Oct 27, 2025
f9a92ad
refactoring types
thorrester Oct 27, 2025
301f98b
refactoring names and parquet tables
thorrester Oct 27, 2025
a194592
lets standardize around event_name
thorrester Oct 27, 2025
e29362c
renaming
thorrester Oct 28, 2025
3ce07de
change import
thorrester Oct 28, 2025
8b49105
restrucutring imports
thorrester Oct 28, 2025
28317fb
renaming
thorrester Oct 28, 2025
b9a5974
renaming
thorrester Oct 28, 2025
c6dc701
renaming
thorrester Oct 28, 2025
1121a82
LLM -> GenAI
thorrester Oct 28, 2025
ac78491
LLMDriftConfig -> GenAIDriftConfig
thorrester Oct 28, 2025
1258c33
LLMDriftProfile -> GenAIDriftProfile
thorrester Oct 28, 2025
0968698
LLM -> GenAI (driftconfig, alertconfig, drifttype)
thorrester Oct 28, 2025
6439915
rename
thorrester Oct 28, 2025
7e868be
renaming for apache dataframes
thorrester Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pyo3 = { version = "0.*", features = ["abi3-py310", "chrono", "anyhow", "extensi
rand = "0.9.*"
rayon = "1.*"
redis = { version = "0.*", features = ["tokio-comp"] }
regex = "1.*"
reqwest = { version = "0.12.*", features = ["json", "multipart", "rustls-tls", "rustls-tls-native-roots", "blocking" ], default-features = false }
rusty-logging="0.*"
semver = "1.*"
Expand Down
12 changes: 6 additions & 6 deletions crates/scouter_client/src/drifter/llm.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use pyo3::prelude::*;
use scouter_drift::{error::DriftError, LLMEvaluator};
use scouter_state::app_state;
use scouter_types::llm::{LLMDriftConfig, LLMDriftMetric, LLMDriftProfile};
use scouter_types::genai::{GenAIDriftConfig, LLMDriftMetric, GenAIDriftProfile};
use scouter_types::{LLMMetricRecord, LLMRecord};
use std::sync::Arc;

Expand All @@ -24,17 +24,17 @@ impl ClientLLMDrifter {

pub fn create_drift_profile(
&mut self,
config: LLMDriftConfig,
config: GenAIDriftConfig,
metrics: Vec<LLMDriftMetric>,
workflow: Option<Bound<'_, PyAny>>,
) -> Result<LLMDriftProfile, DriftError> {
let profile = LLMDriftProfile::new(config, metrics, workflow)?;
) -> Result<GenAIDriftProfile, DriftError> {
let profile = GenAIDriftProfile::new(config, metrics, workflow)?;
Ok(profile)
}

pub async fn compute_drift_single(
record: &LLMRecord,
profile: &LLMDriftProfile,
profile: &GenAIDriftProfile,
) -> Result<Vec<LLMMetricRecord>, DriftError> {
let (metrics, _score, _workflow_duration) =
LLMEvaluator::process_drift_record(record, profile).await?;
Expand All @@ -44,7 +44,7 @@ impl ClientLLMDrifter {
pub fn compute_drift(
&mut self,
data: Vec<LLMRecord>,
profile: &LLMDriftProfile,
profile: &GenAIDriftProfile,
) -> Result<Vec<LLMMetricRecord>, DriftError> {
let results = self.runtime.block_on(async move {
let mut results = Vec::new();
Expand Down
38 changes: 19 additions & 19 deletions crates/scouter_client/src/drifter/scouter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use pyo3::types::PyList;
use pyo3::IntoPyObjectExt;
use scouter_drift::error::DriftError;
use scouter_drift::spc::SpcDriftMap;
use scouter_types::llm::{LLMDriftMap, LLMDriftMetric};
use scouter_types::genai::{GenAIDriftMap, LLMDriftMetric};
use scouter_types::spc::SpcDriftProfile;
use scouter_types::LLMRecord;
use scouter_types::{
custom::{CustomDriftProfile, CustomMetric, CustomMetricDriftConfig},
llm::{LLMDriftConfig, LLMDriftProfile},
genai::{GenAIDriftConfig, GenAIDriftProfile},
psi::{PsiDriftConfig, PsiDriftMap, PsiDriftProfile},
spc::SpcDriftConfig,
DataType, DriftProfile, DriftType,
Expand All @@ -24,13 +24,13 @@ use std::sync::RwLock;
pub enum DriftMap {
Spc(SpcDriftMap),
Psi(PsiDriftMap),
LLM(LLMDriftMap),
LLM(GenAIDriftMap),
}

pub enum DriftConfig {
Spc(Arc<RwLock<SpcDriftConfig>>),
Psi(Arc<RwLock<PsiDriftConfig>>),
LLM(LLMDriftConfig),
LLM(GenAIDriftConfig),
Custom(CustomMetricDriftConfig),
}

Expand All @@ -56,7 +56,7 @@ impl DriftConfig {
}
}

pub fn llm_config(&self) -> Result<LLMDriftConfig, DriftError> {
pub fn llm_config(&self) -> Result<GenAIDriftConfig, DriftError> {
match self {
DriftConfig::LLM(cfg) => Ok(cfg.clone()),
_ => Err(DriftError::InvalidConfigError),
Expand Down Expand Up @@ -88,7 +88,7 @@ impl Drifter {
DriftType::Spc => Ok(Drifter::Spc(SpcDrifter::new())),
DriftType::Psi => Ok(Drifter::Psi(PsiDrifter::new())),
DriftType::Custom => Ok(Drifter::Custom(CustomDrifter::new())),
DriftType::LLM => Ok(Drifter::LLM(ClientLLMDrifter::new())),
DriftType::GenAI => Ok(Drifter::LLM(ClientLLMDrifter::new())),
}
}

Expand Down Expand Up @@ -136,7 +136,7 @@ impl Drifter {
};
let profile =
drifter.create_drift_profile(config.llm_config()?, metrics, workflow)?;
Ok(DriftProfile::LLM(profile))
Ok(DriftProfile::GenAI(profile))
}
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Drifter {
};
let records = drifter.compute_drift(data, profile.get_llm_profile()?)?;

Ok(DriftMap::LLM(LLMDriftMap { records }))
Ok(DriftMap::LLM(GenAIDriftMap { records }))
}
}
}
Expand Down Expand Up @@ -228,8 +228,8 @@ impl PyDrifter {
let config = obj.extract::<CustomMetricDriftConfig>()?;
DriftConfig::Custom(config)
}
DriftType::LLM => {
let config = obj.extract::<LLMDriftConfig>()?;
DriftType::GenAI => {
let config = obj.extract::<GenAIDriftConfig>()?;
DriftConfig::LLM(config)
}
};
Expand Down Expand Up @@ -265,7 +265,7 @@ impl PyDrifter {
DriftProfile::Spc(profile) => Ok(profile.into_bound_py_any(py)?),
DriftProfile::Psi(profile) => Ok(profile.into_bound_py_any(py)?),
DriftProfile::Custom(profile) => Ok(profile.into_bound_py_any(py)?),
DriftProfile::LLM(profile) => Ok(profile.into_bound_py_any(py)?),
DriftProfile::GenAI(profile) => Ok(profile.into_bound_py_any(py)?),
}
}

Expand All @@ -275,11 +275,11 @@ impl PyDrifter {
pub fn create_llm_drift_profile<'py>(
&mut self,
py: Python<'py>,
config: LLMDriftConfig,
config: GenAIDriftConfig,
metrics: Vec<LLMDriftMetric>,
workflow: Option<Bound<'py, PyAny>>,
) -> Result<Bound<'py, PyAny>, DriftError> {
let profile = LLMDriftProfile::new(config, metrics, workflow)?;
let profile = GenAIDriftProfile::new(config, metrics, workflow)?;
Ok(profile.into_bound_py_any(py)?)
}

Expand Down Expand Up @@ -309,9 +309,9 @@ impl PyDrifter {
let profile = drift_profile.extract::<CustomDriftProfile>()?;
DriftProfile::Custom(profile)
}
DriftType::LLM => {
let profile = drift_profile.extract::<LLMDriftProfile>()?;
DriftProfile::LLM(profile)
DriftType::GenAI => {
let profile = drift_profile.extract::<GenAIDriftProfile>()?;
DriftProfile::GenAI(profile)
}
};

Expand All @@ -322,7 +322,7 @@ impl PyDrifter {
let data_type = match data_type {
Some(data_type) => data_type,
None => {
if drift_type == DriftType::LLM {
if drift_type == DriftType::GenAI {
// For LLM, we will handle it separately in the create_llm_drift_profile method
&DataType::LLM
} else {
Expand Down Expand Up @@ -355,12 +355,12 @@ impl PyDrifter {
pub fn create_llm_drift_profile_with_runtime<'py>(
&mut self,
py: Python<'py>,
config: LLMDriftConfig,
config: GenAIDriftConfig,
metrics: Vec<LLMDriftMetric>,
workflow: Option<Bound<'py, PyAny>>,
runtime: Arc<tokio::runtime::Runtime>,
) -> Result<Bound<'py, PyAny>, DriftError> {
let profile = LLMDriftProfile::new_with_runtime(config, metrics, workflow, runtime)?;
let profile = GenAIDriftProfile::new_with_runtime(config, metrics, workflow, runtime)?;
Ok(profile.into_bound_py_any(py)?)
}
}
2 changes: 1 addition & 1 deletion crates/scouter_client/src/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl PyScouterClient {
DriftType::Custom => {
PyScouterClient::get_custom_binned_drift(py, &self.client.client, drift_request)
}
DriftType::LLM => {
DriftType::GenAI => {
PyScouterClient::get_llm_metric_binned_drift(py, &self.client.client, drift_request)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/scouter_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub use scouter_types::{
},
eval::LLMEvalMetric,
llm::{
LLMAlertConfig, LLMDriftConfig, LLMDriftMap, LLMDriftMetric, LLMDriftProfile,
GenAIAlertConfig, GenAIDriftConfig, GenAIDriftMap, GenAIDriftProfile, LLMDriftMetric,
LLMMetricAlertCondition, PaginationCursor, PaginationResponse,
},
psi::{
Expand Down Expand Up @@ -72,6 +72,6 @@ pub use scouter_types::error::{ContractError, ProfileError, RecordError, TypeErr

pub use scouter_evaluate::{
error::EvaluationError,
llm::{async_evaluate_llm, evaluate_llm, workflow_from_eval_metrics},
evaluate::{async_evaluate_llm, evaluate_llm, workflow_from_eval_metrics},
types::{EvaluationConfig, LLMEvalRecord, LLMEvalResults, LLMEvalTaskResult},
};
Loading