distill.rs

 1use anyhow::{Result, anyhow};
 2use std::mem;
 3
 4use crate::example::Example;
 5
 6pub async fn run_distill(example: &mut Example) -> Result<()> {
 7    let [prediction]: [_; 1] =
 8        mem::take(&mut example.predictions)
 9            .try_into()
10            .map_err(|preds: Vec<_>| {
11                anyhow!(
12                    "Example has {} predictions, but it should have exactly one",
13                    preds.len()
14                )
15            })?;
16
17    example.spec.expected_patch = prediction.actual_patch;
18    example.prompt = None;
19    example.predictions = Vec::new();
20    example.score = Vec::new();
21    Ok(())
22}