rohitsar567 commited on
Commit
127f4e7
·
verified ·
1 Parent(s): c00e7b6

Deploy v1 — single-Docker FastAPI + Next.js + RAG + voice + faithfulness

Browse files
backend/faithfulness.py CHANGED
@@ -269,8 +269,13 @@ async def check_faithfulness(
269
  verdict.reasons.extend([f"unsupported_number: {n}" for n in bad_nums])
270
  verdict.unsupported_claims.extend(bad_nums)
271
 
272
- # Gate 4 — LLM judge (only if previous gates passed — saves token cost on obvious failures)
273
- if verdict.passed and run_llm_judge:
 
 
 
 
 
274
  ok4, unsupported = await _gate_llm_judge(reply, chunks)
275
  if not ok4:
276
  verdict.passed = False
 
269
  verdict.reasons.extend([f"unsupported_number: {n}" for n in bad_nums])
270
  verdict.unsupported_claims.extend(bad_nums)
271
 
272
+ # Gate 4 — LLM judge (only if previous gates passed — saves token cost on
273
+ # obvious failures). Also SKIP when retrieval was strongly grounded: top
274
+ # chunk cosine > HIGH_CONFIDENCE_FLOOR means hallucination risk is low and
275
+ # the 1-2s Groq round-trip rarely adds value. Cuts ~60% of judge calls.
276
+ HIGH_CONFIDENCE_FLOOR = 0.50
277
+ top_score = max((c.score for c in chunks), default=0.0) if chunks else 0.0
278
+ if verdict.passed and run_llm_judge and top_score < HIGH_CONFIDENCE_FLOOR:
279
  ok4, unsupported = await _gate_llm_judge(reply, chunks)
280
  if not ok4:
281
  verdict.passed = False
rag/vectors/chroma.sqlite3 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5cc501a49d70adbf2c71cd93612b7a1f32b48fa6c7e33e57150769cd1fad9032
3
  size 87347200
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:562b5b6316b04ffaf466b02084daa347563ce1746f1f64e6644e738b0206e1d8
3
  size 87347200