RAG Chatbot for National Telecommunicstion Coorporation image 1

01 · Overview

Overview

During my work at the National Telecommunication Corporation (NTC), I noticed that employees often spend significant time searching through policy documents, regulations, and manuals to find specific information.

To address this challenge, I developed a Retrieval-Augmented Generation (RAG) chatbot that enables employees to interact with official NTC policy documents using natural language.

The system retrieves relevant information from uploaded PDF documents and generates context-aware responses grounded in the source content. It also supports follow-up questions, document uploads, and persistent chat history, making policy information easier to access and understand.

02 · How I built this project

How I built this project

I developed the chatbot using a document-processing and hybrid retrieval pipeline.

Document Processing

Implemented PDF text extraction using PyMuPDF4LLM and Docling, including OCR support for scanned documents. Applied structure-aware chunking to preserve document sections, headings, and contextual relationships.

Embedding Generation

Used the locally running Ollama model nomic-embed-text to generate embeddings for document chunks, reducing reliance on external embedding APIs.

Hybrid Retrieval

Implemented a Hybrid RAG approach combining semantic vector search with BM25 keyword retrieval.

  • Pinecone Vector Search: Top-15 results
  • BM25 Keyword Search: Top-15 results
  • Result Merging: Combined vector and keyword search results
  • Vector Score Threshold: 0.30 for vector matches

Retrieval Optimization

Incorporated query rewriting to improve retrieval for follow-up questions and conversational queries. Configured retrieval parameters to improve the relevance of retrieved document chunks.

LLM Integration

Integrated Groq for LLM inference to generate responses based on retrieved document context and conversation history.

Backend and User Interface

Built the backend using FastAPI and developed an NTC-themed web interface using HTML, CSS, and JavaScript.

Implemented:

  • PDF uploads and instant document indexing
  • Context-aware conversational follow-ups
  • Persistent chat history
  • Source-grounded responses

03 · Tech stack

Tech stack

3. Tech Stack I Used

  • Programming Language: Python
  • Backend Framework: FastAPI
  • RAG Framework: LangChain
  • Vector Database: Pinecone
  • Keyword Retrieval: BM25
  • LLM Inference: Groq
  • Embedding Model: Ollama – nomic-embed-text
  • Document Processing: PyMuPDF4LLM, Docling, OCR
  • Frontend: HTML, CSS, JavaScript

Core Concepts

  • Retrieval-Augmented Generation (RAG)
  • Hybrid Search
  • Structure-Aware Chunking
  • Query Rewriting
  • Top-K Retrieval
  • Semantic Search
  • Context-Aware Conversations

04 · Results

Results

The project demonstrated how a well-designed retrieval pipeline can improve the usefulness of an AI-powered document assistant.

By combining semantic search with keyword-based retrieval, applying structure-aware chunking, and optimizing retrieval parameters, I developed a system that helps employees find relevant information from official policy documents more efficiently.

One of the most important lessons I learned was that retrieval quality plays a critical role in RAG performance. Improving document processing, chunking, query handling, and retrieval strategies can have a greater impact on answer quality than simply changing the language model.

Future Improvements

  • Automated retrieval evaluation using Precision@K and Recall@K
  • Answer-quality evaluation
  • Improved retrieval and reranking strategies
  • Scaling the retrieval layer for larger document collections

Code and more on GitHub

Repositories, experiments and smaller builds.

Open GitHub