GST_RAG_BACKEND / app /generation /confidence.py
Samaksh25's picture
fix(retrieval): CrossEncoder ms-marco + PRF + synonym expansion
6733714
Raw
History Blame Contribute Delete
377 Bytes
def estimate_confidence(context: str) -> float:
"""
Very simple, honest confidence estimator.
"""
if not context or len(context.strip()) < 50:
return 0.4
if any(rate in context for rate in ["12%", "18%", "5%", "28%"]):
return 0.9
if "notification" in context.lower() or "section" in context.lower():
return 0.8
return 0.6