Confidence routing
lexConfidence is a lexical signal on the hits Knolo already returned. What you do with the number is application policy.
import { query, lexConfidence, makeContextPatch } from '@knolo/core';
const hits = query(pack, question, { topK: 12 });
if (!hits.length) return 'No grounded evidence was found.';
const confidence = lexConfidence(hits);
if (confidence >= 0.72) {
const context = makeContextPatch(hits, { budget: 'mini' });
return smallAnswerModel.answer({ question, context });
}
return answerWithRetrievalGate(pack, question, selectorModel, largeAnswerModel);0.72 is an illustrative application policy, not a universal constant. Calibrate thresholds on your corpus.
| Condition | Suggested route |
|---|---|
| No hits | Abstain or ask for clarification |
| Strong lexical confidence | Small answer model |
| Moderate confidence | Small-model evidence selector |
| Low confidence with semantic data | Optional semantic rerank |
| Evidence still insufficient | Abstain or escalate to human review |
The selector and the answer model in that table are host adapters. Knolo does not choose them.