Skip to content
Work

[LEX-01]

Lexora

RAG-based legal research assistant for Indian law.

  • FastAPI
  • BGE embeddings
  • cross-encoder rerank
  • RAGAS
  • Next.js / Vercel AI SDK
  • Docker
  • Langfuse
  • GCP Cloud Run

Problem

Legal research is slow, and answers are only useful if they're traceable to sources. A lawyer can't act on a confident paragraph with no citation behind it.

Architecture

A FastAPI backend embeds documents with BGE into a vector store, then reranks retrieved chunks with a cross-encoder before they reach the model. Reranking is where retrieval quality is won or lost. RAGAS runs continuous evaluation so regressions surface as numbers, not vibes. The frontend is a streaming Next.js chat. Observability runs through Langfuse, CI/CD through GitHub Actions, deployed on Cloud Run.

  1. 01Queryuser question
  2. 02BGE embedvector store
  3. 03Cross-encoder reranktop-k chunks
  4. 04Grounded answerstreamed + cited

Evidence

The improvement over the baseline is itself the signal. Every number below comes from RAGAS in CI.

RAGAS · BASELINE vs V1
0.930.84
Faithfulness
RAGAS
0.870.75
Context Precision
RAGAS
0.890.75
Context Recall
RAGAS

Reranking did most of the work: a cross-encoder scoring each chunk against the query directly, not just by vector proximity, is what moved context precision from 0.75 to 0.87.

V1 live