MCPcopy Create free account
hub / github.com/openai/plugins / enrichSummary

Function enrichSummary

plugins/plugin-eval/src/core/scoring.js:311–342  ·  view source on GitHub ↗
(result, summary)

Source from the content-addressed store, hash-verified

309}
310
311export function enrichSummary(result, summary) {
312 const deductions = Array.isArray(summary?.deductions) ? summary.deductions : buildDeductions(result.checks);
313 const categoryDeductions = Array.isArray(summary?.categoryDeductions)
314 ? summary.categoryDeductions
315 : buildCategoryDeductions(deductions);
316 const failedErrors = result.checks.filter(
317 (check) => check.status === "fail" && check.severity === "error",
318 ).length;
319 const warningSignals = result.checks.filter((check) => check.status === "warn").length;
320 const actionableChecks = rankActionableChecks(result.checks).map(summarizeFinding);
321 const nextSummary = {
322 ...summary,
323 deductions,
324 categoryDeductions,
325 };
326
327 return {
328 ...nextSummary,
329 whyBullets:
330 Array.isArray(nextSummary.whyBullets) && nextSummary.whyBullets.length > 0
331 ? nextSummary.whyBullets
332 : buildWhyBullets(result, { ...nextSummary, categoryDeductions }, failedErrors, warningSignals),
333 fixFirst:
334 Array.isArray(nextSummary.fixFirst) && nextSummary.fixFirst.length > 0
335 ? nextSummary.fixFirst
336 : actionableChecks.slice(0, 3),
337 watchNext:
338 Array.isArray(nextSummary.watchNext) && nextSummary.watchNext.length > 0
339 ? nextSummary.watchNext
340 : actionableChecks.slice(3, 6),
341 };
342}

Callers 3

ensureEvaluationPayloadFunction · 0.90
computeSummaryFunction · 0.85

Calls 6

buildDeductionsFunction · 0.85
buildCategoryDeductionsFunction · 0.85
rankActionableChecksFunction · 0.85
buildWhyBulletsFunction · 0.85
filterMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected