RAG Service

Production RAG API with hybrid retrieval — dense embeddings + BM25-style keyword scoring, fused with Reciprocal Rank Fusion over a ChromaDB vector store. Grounded answers with citations.

Overview

A FastAPI service that ingests documents, chunks them with overlap, indexes them into a persistent ChromaDB collection, and answers questions with retrieval-augmented generation. Answers are grounded in the retrieved context and cite their sources.

Hybrid Retrieval

Combines dense vector search (cosine similarity over embeddings) with BM25-style keyword scoring, merged via Reciprocal Rank Fusion (RRF). This balances semantic and lexical matching, improving recall over either approach alone.

LLM & Embedding Backends

Embeddings via sentence-transformers (all-MiniLM-L6-v2) with a deterministic hashing embedder fallback for offline/dev. Generation via any OpenAI-compatible chat endpoint, with an offline echo fallback when no API key is set — so the service runs and tests without external dependencies.

Evaluation

Paired with the LLM Eval Harness: faithfulness, answer relevance, and correctness against a golden set, runnable in CI.

Tech Stack

PythonFastAPIChromaDBEmbeddingsHybrid SearchRRFRAGLLM-as-JudgeDocker