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

Function createObservedUsageChecks

plugins/plugin-eval/src/core/observed-usage.js:182–238  ·  view source on GitHub ↗
(summary)

Source from the content-addressed store, hash-verified

180}
181
182function createObservedUsageChecks(summary) {
183 const checks = [];
184
185 if (summary.sampleCount < 3) {
186 checks.push(
187 createCheck({
188 id: "observed-usage-small-sample",
189 category: "measurement",
190 severity: "warning",
191 status: "warn",
192 message: "Observed usage coverage is too small to trust as a stable benchmark yet.",
193 evidence: [`Samples collected: ${summary.sampleCount}`],
194 remediation: ["Capture at least 5 to 10 representative sessions before treating observed usage as a baseline."],
195 }),
196 );
197 }
198
199 const comparison = summary.estimateComparison;
200 if (comparison) {
201 if (comparison.band === "drift" || comparison.band === "wide-drift") {
202 checks.push(
203 createCheck({
204 id: "observed-usage-estimate-drift",
205 category: "budget",
206 severity: comparison.band === "wide-drift" ? "error" : "warning",
207 status: comparison.band === "wide-drift" ? "fail" : "warn",
208 message: "Static budget estimates differ meaningfully from observed input token usage.",
209 evidence: [
210 `Estimated active tokens: ${comparison.estimatedActiveTokens}`,
211 `Observed average input tokens: ${comparison.observedAverageInputTokens}`,
212 `Delta ratio: ${round(comparison.deltaRatio * 100)}%`,
213 ],
214 remediation: [
215 "Trim repeated instructions or supporting text if the observed value is higher than expected.",
216 "If the static estimate is intentionally conservative, record that assumption in the skill or plugin references.",
217 ],
218 }),
219 );
220 }
221
222 if (summary.cachedTokens.average > 0) {
223 checks.push(
224 createCheck({
225 id: "observed-usage-cache-present",
226 category: "measurement",
227 severity: "info",
228 status: "info",
229 message: "Observed runs include cached tokens, so repeated sessions are cheaper than the cold-start estimate.",
230 evidence: [`Average cached tokens: ${summary.cachedTokens.average}`],
231 remediation: ["Track cold-start and warm-cache sessions separately if you need tighter budgeting."],
232 }),
233 );
234 }
235 }
236
237 return checks;
238}
239

Callers 1

analyzeObservedUsageFunction · 0.85

Calls 2

createCheckFunction · 0.90
roundFunction · 0.85

Tested by

no test coverage detected