<ARYA/>
← All projects

2025

LLQP Study Assistant RAG System

Agentic RAG chatbot for Canadian insurance exam preparation

PythonFastAPIPostgreSQLQdrantOpenAI APIRAGLLMVector SearchReactDockerTelegram Bot APIAlembic

Overview

A production-grade agentic RAG system built for candidates studying for the LLQP — the Canadian life insurance licensing exam. The assistant ingests official study PDFs, embeds them into a Qdrant vector database, and answers exam-focused questions with grounded, cited responses. It runs as both a web chat widget and a Telegram bot, serving the same RAG pipeline through two interfaces.

The Problem

LLQP study material is dense, spans multiple PDFs, and is poorly indexed for targeted exam practice. Candidates waste time searching manually for specific rules, definitions, and scenarios. The goal was an assistant that could answer any LLQP question with a precise, source-backed answer — scoped entirely to the official material and nothing beyond it.

My Role

Designed and built the full system end to end — database schema, document ingestion pipeline, chunking and embedding strategy, retrieval logic, prompt design, and both interfaces. Currently actively iterating on chunk quality, retrieval accuracy, and LLM output grounding.

Key Features

  • PDF ingestion pipeline — text extraction, cleaning, chunking, and batch upload with per-file error handling
  • OpenAI embeddings stored in Qdrant with semantic vector search and relevance scoring
  • Agentic RAG pipeline: retriever → prompt builder → LLM → cited response
  • Source citations returned per answer — document name, page number, and similarity score
  • Web chat widget (React + Vite) connecting to the FastAPI backend
  • Telegram Bot interface sharing the same RAG pipeline with Telegram-formatted plain-text output
  • Conversation history stored in PostgreSQL with per-session context retention
  • Health check endpoints for backend, database, and Qdrant collection status
  • Docker Compose setup for full local development stack and production deployment
  • Debug mode exposing retrieved chunk details for pipeline inspection and tuning

Challenges

Chunking strategy is the hardest variable. LLQP material mixes dense regulatory text, definitions, and scenario-based examples — and naive fixed-size chunks break these apart in ways that destroy retrieval quality. The current focus is on optimizing chunk boundaries, overlap strategy, and re-ranking to improve answer accuracy on complex multi-concept questions.

What I Learned

Retrieval quality lives and dies with the chunking layer. Architecture and prompt design matter, but the most impactful work is understanding how the source material is structured and slicing it in ways that preserve meaning rather than just fitting a token budget.