From a3fd8e68817a1e04373930065878d403d720568d Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Thu, 22 Jan 2026 19:32:03 +0200 Subject: [PATCH] ep: Don't fail on lines with inference errors (#47406) Release Notes: - N/A --- crates/edit_prediction_cli/src/example.rs | 11 +++++++++++ crates/edit_prediction_cli/src/predict.rs | 2 ++ 2 files changed, 13 insertions(+) diff --git a/crates/edit_prediction_cli/src/example.rs b/crates/edit_prediction_cli/src/example.rs index d232ece51f88c0b03f72e05f846b858c136d2e5d..0b97c71902eef53a1c893fc3c7d7637344b220b2 100644 --- a/crates/edit_prediction_cli/src/example.rs +++ b/crates/edit_prediction_cli/src/example.rs @@ -75,10 +75,21 @@ pub struct ExamplePrompt { pub struct ExamplePrediction { #[serde(default, skip_serializing_if = "Option::is_none")] pub actual_patch: Option, + #[serde(deserialize_with = "deserialize_null_as_empty_string")] pub actual_output: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, pub provider: PredictionProvider, } +fn deserialize_null_as_empty_string<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let opt = Option::::deserialize(deserializer)?; + Ok(opt.unwrap_or_default()) +} + #[derive(Clone, Debug, Serialize, Deserialize)] pub struct ExampleScore { pub delta_chr_f: f32, diff --git a/crates/edit_prediction_cli/src/predict.rs b/crates/edit_prediction_cli/src/predict.rs index b73a8121e88d4ea4a7a2b2ded591fff42970c507..1c14327bb24b54ab2b7e4d980a3f2f4c88488150 100644 --- a/crates/edit_prediction_cli/src/predict.rs +++ b/crates/edit_prediction_cli/src/predict.rs @@ -197,6 +197,7 @@ pub async fn run_prediction( .push(ExamplePrediction { actual_patch: None, actual_output: String::new(), + error: None, provider, }); @@ -302,6 +303,7 @@ async fn predict_anthropic( let prediction = ExamplePrediction { actual_patch: Some(actual_patch), actual_output, + error: None, provider: if batched { PredictionProvider::Teacher(version) } else {