MCPcopy Create free account
hub / github.com/concensure/Semantic / build_model_performance

Function build_model_performance

patch_memory/src/lib.rs:263–288  ·  view source on GitHub ↗
(records: &[PatchRecord])

Source from the content-addressed store, hash-verified

261}
262
263fn build_model_performance(records: &[PatchRecord]) -> Vec<ModelPerformance> {
264 let mut grouped: HashMap<String, (usize, usize)> = HashMap::new();
265 for r in records {
266 let entry = grouped.entry(r.model_used.clone()).or_insert((0, 0));
267 entry.0 += 1;
268 if is_success(r) {
269 entry.1 += 1;
270 }
271 }
272
273 let mut out: Vec<ModelPerformance> = grouped
274 .into_iter()
275 .map(|(model, (total, success))| ModelPerformance {
276 model,
277 success_rate: if total == 0 {
278 0.0
279 } else {
280 success as f32 / total as f32
281 },
282 avg_latency_ms: 0,
283 avg_cost: 0.0,
284 })
285 .collect();
286 out.sort_by(|a, b| a.model.cmp(&b.model));
287 out
288}
289
290#[cfg(test)]
291mod tests {

Callers 3

model_performanceMethod · 0.85
export_history_graphMethod · 0.85
recompute_aggregatesMethod · 0.85

Calls 1

is_successFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…