Haziq Ali · Full Stack Developer
73.06°E
LanguageEN
Retrieval · 2024

RAG Chatbot

A retrieval-augmented chatbot that ingests your PDFs, embeds them into MongoDB Atlas Vector Search, and answers questions grounded in the documents you trained it on.

  • LangChain
  • MongoDB Atlas
  • OpenAI
  • Next.js
mongodb-rag-app-ruby-one.vercel.app ↗

Overview

This was my working ground for RAG fundamentals: take an arbitrary PDF, turn it into a knowledge base, and have a chatbot answer from it instead of from the model’s priors. Built on LangChain with MongoDB Atlas as the vector store, it covers the whole loop — upload, chunk, embed, index, retrieve, answer.

Key Features

  • Document training flow: A dedicated upload interface where PDFs are chunked and embedded into an Atlas collection, so a user can point the bot at their own corpus without touching code.
  • Atlas Vector Search retrieval: A 1536-dimension vector index over the embedded chunks, queried at request time to pull the passages most relevant to the question.
  • Grounded answering: Retrieved context is composed into the prompt so responses stay anchored to the uploaded material rather than the model’s general knowledge.
  • One-click deployment: Environment-driven configuration and Vercel deployment with the MongoDB Atlas integration wired in.

Technologies Used

  • LangChain: Chunking, embedding, retrieval, and chain orchestration.
  • MongoDB Atlas Vector Search: Vector storage and similarity search alongside the operational data.
  • OpenAI Embeddings + Chat: Embedding generation and answer synthesis.
  • Next.js + TypeScript: Upload interface, chat surface, and API routes.
  • Vercel: Hosting and environment management.

Challenges and Learnings

Retrieval quality lives or dies on chunking. Chunks too small and answers lose their context; too large and the embedding blurs across unrelated ideas until similarity search stops discriminating. Tuning chunk size and overlap against real documents — rather than trusting defaults — was the single highest-leverage change, and it’s a lesson that has held on every RAG system I’ve built since, including the Page Index pipelines at Rhazes AI.

Outcome

A complete, deployable RAG reference implementation. More importantly, it’s where the intuitions behind my later production retrieval work — citation grounding, source traceability, chunk-level metadata — first got tested.

Contact

Let's talk.

Based in Düsseldorf. Open to full-stack and lead engineering work, on site in NRW, across Germany, or fully remote.