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

Function buildRiskReasons

plugins/plugin-eval/src/core/scoring.js:227–254  ·  view source on GitHub ↗
({ score, failedErrors, warningSignals, deductions, checkSummary })

Source from the content-addressed store, hash-verified

225}
226
227function buildRiskReasons({ score, failedErrors, warningSignals, deductions, checkSummary }) {
228 const reasons = [];
229 if (failedErrors > 0) {
230 const examples = deductions
231 .filter((entry) => entry.status === "fail" && entry.severity === "error")
232 .slice(0, 3)
233 .map((entry) => entry.id);
234 reasons.push(
235 `Contains ${failedErrors} failing error check${failedErrors === 1 ? "" : "s"}${
236 examples.length > 0 ? ` (${examples.join(", ")})` : ""
237 }.`,
238 );
239 }
240 if (score < GRADE_THRESHOLDS.C) {
241 reasons.push(`Overall score is below ${GRADE_THRESHOLDS.C}, which the evaluator treats as high risk.`);
242 } else if (warningSignals > 0) {
243 reasons.push(
244 `Contains ${warningSignals} warning signal${warningSignals === 1 ? "" : "s"} that still need attention.`,
245 );
246 }
247 if (checkSummary.info > 0 && reasons.length === 0) {
248 reasons.push("No failing or warning checks were found; remaining items are informational only.");
249 }
250 if (reasons.length === 0) {
251 reasons.push("No failing error checks and no warning signals were found.");
252 }
253 return reasons;
254}
255
256export function computeSummary(result) {
257 const deductions = buildDeductions(result.checks);

Callers 1

computeSummaryFunction · 0.85

Calls 2

mapMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected