Change summary
crates/edit_prediction_cli/src/example.rs | 11 +++++++++++
crates/edit_prediction_cli/src/predict.rs | 2 ++
2 files changed, 13 insertions(+)
Detailed changes
@@ -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,
@@ -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 {