UNPKG

@prism-lang/confidence

Version:

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

51 lines 1.8 kB
import { ConfidenceResult, ConsistencyOptions, ResponseAnalysisOptions } from './types'; /** * Main confidence extractor class providing three levels of API */ export declare class ConfidenceExtractor { /** * Level 1: Dead simple extraction */ extract(response: string | any): Promise<ConfidenceResult>; /** * Level 2: Some control over extraction method */ extractWithOptions(response: string | any, options: { method: 'consistency' | 'response_analysis' | 'structured'; samples?: number; [key: string]: any; }): Promise<ConfidenceResult>; /** * Level 3: Full control - use individual methods directly */ /** * Extract confidence from multiple samples using consistency */ fromConsistency(sampler: () => Promise<string>, options?: ConsistencyOptions): Promise<ConfidenceResult>; /** * Extract confidence from response characteristics */ fromResponseAnalysis(response: string, options?: ResponseAnalysisOptions): Promise<ConfidenceResult>; /** * Extract confidence from structured response */ fromStructuredResponse(response: string): Promise<ConfidenceResult>; /** * Generate explanation for why this confidence was assigned */ explain(result: ConfidenceResult): string; private calculateOverlap; private calculateConsistency; private consistencyToConfidence; private generateConsistencyExplanation; private analyzeHedging; private analyzeCertainty; private analyzeSpecificity; private analyzeCompleteness; private aggregateScores; private generateAnalysisExplanation; private findHedgingIndicators; private findCertaintyIndicators; private buildProvenance; } //# sourceMappingURL=extractor.d.ts.map