A production-ready Retrieval-Augmented Generation (RAG) system built to eliminate LLM hallucinations. This project provides context-aware responses by grounding AI generations in verified local document data, complete with source metadata for transparency and reduce unnecessary tokens (10^18 bytes / 1 quintillion data).
This project handles the end-to-end RAG lifecycle:
- Ingestion: Parsing and chunking documents.
- Filtering: Filter documents only necessary metadata
- Chunking: Used Recursive Text Splitter
- Embedding: Converting text to high-dimensional vectors.
- Retrieval: Performing similarity searches to find relevant context. (Query of user converted using the same embedding model)
- Augmentation: Passing context + metadata to the LLM to ensure factual accuracy.
- Backend: Python, Flask
- Orchestration: LangChain
- Vector Databases: Pinecone Vector Database
- Embeddings: llama embed text v2
- UI: Custom Chatbot Interface (HTML/CSS/JS)
- Loaders: Utilizes LangChain loaders to process raw data. (PyPDFLoaders)
- Chunking: Employs
RecursiveCharacterTextSplitterto maintain semantic integrity across text segments. - Vector Stores: * Pinecone: Used for server side embedding with cloud vector database.
- Context Awareness: The system retrieves the top-$k$ most relevant chunks based on user queries.
- Metadata Tracking: Unlike standard RAG, this system tracks and displays source metadata (e.g., page numbers) alongside the answer to ensure auditability.
- Anti-Hallucination: Strictly constrains the LLM to generate answers only from the retrieved context.
-
Clone the Repo:
git clone https://github.com/idAryan/Study_rag-_chatbot.git cd Study_rag-_chatbot -
Install Requirements:
pip install -r requirements.txt
-
Launch: Create a
.envfile for your API keys:flask run
Developed by: Aryan Sharma
B.Tech - Artificial Intelligence & Machine Learning