Skip to content

Commit 630b9ff

Browse files
authored
Merge pull request #144 from demml/143/dont-serialize-embeddings
no serialization
2 parents e05302a + 6ea8b4d commit 630b9ff

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

crates/scouter_evaluate/src/types.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ impl LLMEvalResults {
148148
&10,
149149
false,
150150
)?;
151-
152151
self.histograms = Some(histograms);
153152
}
154153
}
@@ -197,7 +196,12 @@ impl LLMEvalResults {
197196
let x = reduced.column(0).to_vec();
198197
let y = reduced.column(1).to_vec();
199198

200-
self.cluster_data = Some(ClusterData::new(x, y, dataset.clusters.clone()));
199+
self.cluster_data = Some(ClusterData::new(
200+
x,
201+
y,
202+
dataset.clusters.clone(),
203+
dataset.idx_map.clone(),
204+
));
201205
}
202206

203207
Ok(())
@@ -213,11 +217,22 @@ pub struct ClusterData {
213217
pub y: Vec<f64>,
214218
#[pyo3(get)]
215219
pub clusters: Vec<i32>,
220+
pub idx_map: HashMap<usize, String>,
216221
}
217222

218223
impl ClusterData {
219-
pub fn new(x: Vec<f64>, y: Vec<f64>, clusters: Vec<i32>) -> Self {
220-
ClusterData { x, y, clusters }
224+
pub fn new(
225+
x: Vec<f64>,
226+
y: Vec<f64>,
227+
clusters: Vec<i32>,
228+
idx_map: HashMap<usize, String>,
229+
) -> Self {
230+
ClusterData {
231+
x,
232+
y,
233+
clusters,
234+
idx_map,
235+
}
221236
}
222237
}
223238

@@ -340,6 +355,7 @@ pub struct LLMEvalTaskResult {
340355
pub metrics: BTreeMap<String, Score>,
341356

342357
#[pyo3(get)]
358+
#[serde(skip)]
343359
pub embedding: BTreeMap<String, Vec<f32>>,
344360

345361
#[pyo3(get)]

0 commit comments

Comments
 (0)