UNPKG

@prism-lang/confidence

Version:

Confidence extraction library for Prism - standardized patterns for extracting confidence values from LLMs and other sources

53 lines 1.83 kB
import { DomainCalibrationConfig, CalibrationCurve } from './types'; /** * Base calibrator class for domain-specific confidence adjustment */ export declare abstract class DomainCalibrator { protected config: DomainCalibrationConfig; constructor(config: DomainCalibrationConfig); /** * Calibrate a raw confidence value based on domain knowledge */ calibrate(rawConfidence: number, context: any): Promise<number>; /** * Get explanation for calibration adjustments */ explainCalibration(rawConfidence: number, context: any): Promise<string>; protected abstract categorize(context: any): string | null; protected applyCurve(value: number, curve: CalibrationCurve, context: any): number; protected checkCondition(_condition: string, _context: any): boolean; protected applyTemporalDecay(value: number, timestamp: Date): number; private getAge; private parseHalfLife; } /** * Security-specific calibrator */ export declare class SecurityCalibrator extends DomainCalibrator { constructor(); protected categorize(context: any): string | null; protected checkCondition(condition: string, context: any): boolean; } /** * Interactive calibrator that learns from feedback */ export declare class InteractiveCalibrator extends DomainCalibrator { private history; constructor(domain: string); /** * Provide feedback on a prediction */ feedback(prediction: any, actualOutcome: any): void; /** * Save the learned calibration */ save(_name: string): string; /** * Load a saved calibration */ static load(data: string): InteractiveCalibrator; protected categorize(context: any): string | null; private recalibrate; private evaluatePrediction; } //# sourceMappingURL=calibration.d.ts.map