Skip to main content

qualia_core_db/inference/conditioning_eval/
corpus.rs

1//! Versioned task manifests and split enforcement for held-out evaluation.
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum SplitType {
5    Train,
6    Dev,
7    HeldOutTest,
8}
9
10#[derive(Debug, Clone)]
11pub struct TaskItem {
12    pub task_id: String,
13    pub split: SplitType,
14    pub prompt: String,
15    pub expected_outcome: String,
16    pub domain: String,
17}
18
19#[derive(Debug, Clone)]
20pub struct TaskManifest {
21    pub manifest_id: String,
22    pub version: u32,
23    pub tasks: Vec<TaskItem>,
24}
25
26impl TaskManifest {
27    /// Creates a default `TaskManifest`.
28    pub fn new(manifest_id: impl Into<String>, version: u32) -> Self {
29        Self {
30            manifest_id: manifest_id.into(),
31            version,
32            tasks: Vec::new(),
33        }
34    }
35
36    /// Appends a task to the manifest.
37    pub fn add_task(&mut self, task: TaskItem) {
38        self.tasks.push(task);
39    }
40
41    /// Iterates held-out tasks.
42    pub fn held_out_tasks(&self) -> impl Iterator<Item = &TaskItem> {
43        self.tasks
44            .iter()
45            .filter(|t| t.split == SplitType::HeldOutTest)
46    }
47}