manikanta.
← All workNext project →
Production RAG · Jan 2026AI / ML

PolicyQA

A question-answering service over nine Indian labour-law documents, built so that every answer can be traced back to the clause it came from, and so the pipeline cannot ship if its numbers slip.

Role
Solo: retrieval, eval, deploy
Timeline
January 2026
Status
Live on Cloud Run
0.955
Retrieval hit rate
0.941
Answer faithfulness
0.964
Citation accuracy
9
Policy documents
The problem

Labour-law questions are keyword-sensitive. A section number matters as much as the semantics around it. Pure vector search misses exact references; pure keyword search misses paraphrase.

So the answer had to be hybrid, and it had to be verifiable: a legal answer without a citation is worse than no answer at all.

Architecture
STAGE 01

Hybrid retrieval

BM25 keyword search runs alongside vector semantic search over ChromaDB, and the two candidate lists are merged by Reciprocal Rank Fusion.

STAGE 02

Cross-encoder rerank

ms-marco-MiniLM rescores the fused candidates pairwise against the query, cutting to the top five passages actually worth sending to the model.

STAGE 03

Grounded generation

Google Gemini answers from those five passages only, with citations back to source clauses; Langfuse traces every call for inspection.

Evaluation
MeasureResultMethod
Retrieval hit rate0.95522-question set
Answer faithfulness0.941LLM-as-judge
Citation accuracy0.964LLM-as-judge
Deploy gatePass/failCI quality gate
Stack
  • Python
  • LangChain
  • Google Gemini
  • ChromaDB
  • BM25
  • Cross-encoder
  • FastAPI
  • Streamlit
  • Docker
  • Cloud Run
  • Langfuse
Deployment

Containerised with Docker and deployed to Google Cloud Run: a FastAPI backend, a Streamlit front end, and automated evaluation as a quality gate that blocks the deploy on metric degradation.

What I'd do next

Want the walkthrough? I'll show you the repo.