/** * Adaptive Confidence Gate. * * The original retrieval uses a static minScore (0.3) regardless of how * specific the query is. That is too permissive for narrow lookups and too * strict for exploratory ones. The gate classifies the query and applies a * threshold proportional to how much precision the caller is implicitly * asking for. */ import type { SearchResult } from "@massa-th0th/shared"; import type { QueryClass } from "../types.js"; export interface ConfidenceGateConfig { enabled: boolean; thresholds: { specific: number; focused: number; broad: number; }; } /** * Classify a query into specific / focused / broad based on cheap heuristics. * Sub-millisecond — no LLM call, no tokenizer dependency. */ export declare function classifyQuery(query: string): QueryClass; /** * IMP-16: cheap pre-filter applied BEFORE attention/chain/diversity. * * Cuts only results that *have* a raw vector score below the gate threshold — * they would be cut by the final gate anyway. Saves the downstream pipeline * from re-ranking, tokenizing, and applying chain boosts to candidates that * cannot survive. Results without a raw score are passed through unchanged * and go through the full pipeline as before; the late gate still has the * final word. * * Returns the surviving results plus the threshold/class for callers that * want to log or surface the decision. */ export declare function prefilterByRawScore(results: SearchResult[], query: string, config: ConfidenceGateConfig): { results: SearchResult[]; queryClass: QueryClass; threshold: number; cut: number; }; export declare function applyConfidenceGate(results: SearchResult[], query: string, config: ConfidenceGateConfig): { results: SearchResult[]; queryClass: QueryClass; threshold: number; }; //# sourceMappingURL=confidence-gate.d.ts.map