Allow re-running from examples with changed provider

This commit is contained in:
Max Brunsfeld
2025-12-29 19:19:00 -08:00
parent defcc2f51b
commit 5cfdfd32c6
2 changed files with 9 additions and 5 deletions

View File

@@ -151,7 +151,7 @@ struct PredictArgs {
repetitions: usize,
}
#[derive(Clone, Copy, Debug, ValueEnum, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, ValueEnum, Serialize, Deserialize)]
enum PredictionProvider {
Sweep,
Mercury,

View File

@@ -28,12 +28,16 @@ pub async fn run_prediction(
app_state: Arc<EpAppState>,
mut cx: AsyncApp,
) -> anyhow::Result<()> {
if !example.predictions.is_empty() {
return Ok(());
}
let provider = provider.context("provider is required")?;
if let Some(existing_prediction) = example.predictions.first() {
if existing_prediction.provider == provider {
return Ok(());
} else {
example.predictions.clear();
}
}
run_context_retrieval(example, app_state.clone(), cx.clone()).await?;
if matches!(