Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep: Don't fail on lines with inference errors (#47406)
Oleksiy Syvokona3fd8e68817a
diff --git a/crates/edit_prediction_cli/src/example.rs b/crates/edit_prediction_cli/src/example.rsindex d232ece51f8..0b97c71902e 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<String>,+ #[serde(deserialize_with = "deserialize_null_as_empty_string")]pub actual_output: String,+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub error: Option<String>,pub provider: PredictionProvider,}+fn deserialize_null_as_empty_string<'de, D>(deserializer: D) -> Result<String, D::Error>+where+ D: serde::Deserializer<'de>,+{+ let opt = Option::<String>::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.rsindex b73a8121e88..1c14327bb24 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 {