Testing and calibration
Local verification
npm install
npm run check
npm test
npm run build
The suite runs without API keys by using mock providers.
Covered behavior
- Consistency: identical vs contradictory samples, uncertain-band LLM judge blending.
- Grounding: evidence selection, unsupported claim detection, batched entailment with fallback.
- Citations: western citations, bracket source indexes, numeric mismatch notes.
- Scoring: weighting, level thresholds, citation penalty.
- Providers: OpenAI Responses request mapping, resilience retry and timeout.
Calibration loop before production
- Collect 100–500 labeled examples from your real traffic: supported, partially supported, fabricated, mis-cited.
- Run
evaluatewith fixed prompts and sources; record each signal separately. - Choose thresholds by risk: optimize recall for fabrication in high-risk domains, precision in low-risk UX.
- Freeze a regression set and run it in CI with recorded provider fixtures.
- Add a weekly real-model sample review to catch provider drift.
Known limits
- No embedding/vector retrieval yet; evidence retrieval is lexical sentence matching.
- Numeric citation checks are exact string matches after normalization; unit conversion and rounded figures need domain rules.
- Real provider behavior should be verified with integration tests before claiming a cross-provider guarantee.