Confidence Calibrator
Path:
pi-cybernetic/src/monitors/confidence-calibrator.tsRelative: src/monitors/confidence-calibrator.tsSubproject: pi-cyberneticCategory: cybernetic-coreLines: 59Bytes: 1,723Imports: 1Exports: 2
Content Preview
- /** P5 — Brier-score confidence calibration over (stated confidence, outcome) pairs. */
- import type { Escalation } from "../types/index.ts";
- interface CalibrationSample {
- confidence: number;
- success: boolean;
- }
- const CONFIDENCE_RE = /confidence[:=\s]+(\d+(?:\.\d+)?)\s*(%)?/i;
- /** Deterministic extraction of a stated confidence (0..1) from assistant text. */
- export function extractStatedConfidence(text: string): number | undefined {
- const match = CONFIDENCE_RE.exec(text);
- if (!match?.