RAGLink is an Enterprise Retrieval-Augmented Generation (RAG) platform that enables employees to interact with organizational knowledge using natural language.
Instead of manually searching through company policies, HR documents, technical manuals, infrastructure guides, and project documentation, users can simply ask questions through an AI-powered chat interface.
The system intelligently understands user queries, retrieves the most relevant information using Hybrid Retrieval, validates the retrieved evidence, and generates context-aware responses using Groq Llama 3.1.
Built with a modular architecture using Django, LangChain, LangGraph, ChromaDB, and BM25, RAGLink demonstrates how modern AI systems can be integrated into enterprise knowledge management.
- Role-Based Authentication
- Admin Dashboard
- Team Lead Dashboard
- Employee Dashboard
- Secure Session Management
- Upload Enterprise Documents
- Manage Knowledge Base
- Automatic Document Processing
- Dynamic Document Indexing
- Enterprise Search
- Query Rewriting
- Query Expansion
- Intent Classification
- Entity Extraction
- Entity Normalization
- Metadata Detection
- Semantic Retrieval (ChromaDB)
- Sparse Retrieval (BM25)
- Hybrid Retrieval
- Reciprocal Rank Fusion (RRF)
- Cross-Encoder Reranking
- Context Refinement
- Context Compression
- Evidence Validation
- Prompt Construction
- Grounded Answer Generation
- Calculator
- Date Tool
- Time Tool
- Web Search
- Query Router
- Memory Cache
- Redis Cache
- LangGraph Workflow
- Modular Architecture
- Unit Testing
Organizations store thousands of internal documents including
- Company Policies
- HR Guidelines
- Technical Documentation
- Infrastructure Manuals
- Employee Handbooks
- Project Documents
- Security Policies
- Standard Operating Procedures
Finding relevant information across these documents is often slow and inefficient.
Traditional keyword search returns many irrelevant results, forcing employees to manually inspect multiple documents.
RAGLink solves this problem by combining Retrieval-Augmented Generation with Hybrid Retrieval to provide fast, reliable, and context-aware answers grounded in enterprise knowledge.
| Category | Technology |
|---|---|
| Programming Language | Python 3.13 |
| Backend Framework | Django |
| Frontend | HTML5, CSS3, JavaScript |
| Database | MySQL |
| Large Language Model | Groq Llama 3.1 (Llama-3.1-8B-Instant) |
| AI Framework | LangChain |
| Workflow Engine | LangGraph |
| Embedding Model | HuggingFace Sentence Transformers (all-MiniLM-L6-v2) |
| Vector Database | ChromaDB |
| Sparse Retrieval | BM25 |
| Hybrid Retrieval | Reciprocal Rank Fusion (RRF) |
| Reranking | Cross-Encoder (ms-marco-MiniLM-L-6-v2) |
| Caching | Memory Cache, Redis Cache |
| Document Processing | PDF, DOCX, TXT Processing |
| Testing | Python unittest |
| Version Control | Git & GitHub |
flowchart TB
subgraph Client
A["👤 Employee"]
end
subgraph Presentation
B["💻 Django Web Application"]
C["🔐 Authentication"]
D["📊 Role-Based Dashboard"]
E["💬 Chat Interface"]
end
subgraph Processing
F["🧭 Query Router"]
G["🧠 Enterprise RAG Pipeline"]
end
subgraph Knowledge
H["📄 Enterprise Documents"]
I["🗄️ ChromaDB"]
J["📑 BM25 Index"]
K["🗃️ MySQL"]
end
subgraph AI
L["🤖 Groq Llama 3.1"]
end
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
H --> G
G --> I
G --> J
C --> K
G --> L
L --> E
flowchart LR
A["👤 Employee"]
B["🔐 Login"]
C["📊 Dashboard"]
D["💬 Chat Interface"]
E["🧭 Query Router"]
F["🧠 Enterprise RAG Pipeline"]
G["🤖 Groq Llama 3.1"]
H["✅ Grounded Response"]
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
G --> H
| Component | Purpose |
|---|---|
| Authentication | Manages user login, roles, and access control. |
| Chat Interface | Provides an interactive interface for employees to ask questions. |
| Query Router | Routes queries to the RAG pipeline or utility tools. |
| Enterprise RAG Pipeline | Coordinates retrieval, ranking, and answer generation. |
| Hybrid Retriever | Combines semantic and keyword-based retrieval. |
| Cross Encoder | Reranks retrieved documents for improved relevance. |
| Context Processor | Refines and compresses retrieved information. |
| Evidence Checker | Validates supporting evidence before generation. |
| Prompt Builder | Constructs optimized prompts for the language model. |
| Groq Llama 3.1 | Generates grounded responses using retrieved context. |
| ChromaDB | Stores vector embeddings for semantic search. |
| BM25 | Performs sparse keyword-based retrieval. |
| MySQL | Stores application data, users, and metadata. |
The project follows a layered, modular architecture that separates user management, document processing, retrieval, and response generation into independent components. This design improves maintainability, scalability, and extensibility while keeping each module focused on a specific responsibility.
Presentation Layer
│
▼
Authentication
│
▼
Chat Interface
│
▼
Query Router
│
▼
Enterprise RAG Pipeline
│
▼
Knowledge Retrieval
│
▼
Response Generation
Unlike a traditional chatbot that directly sends user queries to a Large Language Model (LLM), RAGLink follows a multi-stage Retrieval-Augmented Generation (RAG) pipeline. Each stage improves the quality of retrieval and ensures that responses are grounded in enterprise knowledge rather than relying solely on the model's pre-trained information.
flowchart LR
A["👤 User Query"]
B["🧠 Query Understanding"]
C["🎯 Retrieval Planner"]
D["🔎 Hybrid Retrieval"]
E["📚 ChromaDB"]
F["🔤 BM25"]
G["⚖️ Reciprocal Rank Fusion"]
H["🎯 Cross-Encoder Reranker"]
I["📑 Context Refinement"]
J["🗜️ Context Compression"]
K["🛡️ Evidence Validation"]
L["📝 Prompt Builder"]
M["🤖 Groq Llama 3.1"]
N["✅ Grounded Response"]
A --> B
B --> C
C --> D
D --> E
D --> F
E --> G
F --> G
G --> H
H --> I
I --> J
J --> K
K --> L
L --> M
M --> N
The query is analyzed before retrieval to improve search quality.
- Query Rewriting
- Intent Classification
- Entity Extraction
- Entity Normalization
- Query Expansion
- Metadata Detection
Input
Tell me about Meridian cloud.
↓
Optimized Query
Explain the cloud infrastructure used in Project Meridian.
Instead of searching every document, RAGLink first determines where the query should search.
The Retrieval Planner identifies:
- Project Documents
- Company Policies
- HR Documents
- Infrastructure Guides
- Technical Documentation
- Metadata Filters
This reduces unnecessary retrieval and improves response accuracy.
RAGLink combines two complementary retrieval strategies:
- Uses HuggingFace Embeddings
- Searches ChromaDB
- Finds semantically similar content
- Uses BM25
- Matches exact keywords
- Handles technical terms and abbreviations
Both retrieval results are merged using Reciprocal Rank Fusion (RRF).
flowchart TB
A["Optimized Query"]
B["Semantic Search"]
C["Sparse Search"]
D["ChromaDB"]
E["BM25"]
F["RRF Fusion"]
G["Candidate Documents"]
A --> B
A --> C
B --> D
C --> E
D --> F
E --> F
F --> G
The retrieved documents are scored using a Cross-Encoder model to identify the most relevant chunks.
- Better ranking quality
- Reduced irrelevant context
- Improved final answer accuracy
Before generation, the retrieved content is optimized.
- Removes duplicate chunks
- Cleans noisy text
- Orders information logically
- Keeps only the most relevant content
- Reduces prompt size
- Improves response speed
Before sending the prompt to the LLM, RAGLink verifies that the retrieved evidence is sufficient.
If relevant evidence is unavailable, the system avoids hallucinations and informs the user that the requested information is not available in the enterprise knowledge base.
The Prompt Builder combines:
- User Query
- Retrieved Context
- System Instructions
- Safety Constraints
into a structured prompt for the language model.
The final prompt is passed to Groq Llama 3.1, which generates a grounded response using only the retrieved enterprise knowledge.
Administrators can upload new enterprise documents without rebuilding the entire knowledge base.
Whenever a document is uploaded, the system automatically:
- Extracts text
- Splits the document into chunks
- Generates embeddings
- Updates ChromaDB
- Updates the BM25 index
The document becomes immediately searchable.
flowchart LR
A["📄 Upload Document"]
B["📝 Text Extraction"]
C["✂️ Chunking"]
D["🧠 Embedding Generation"]
E["📚 ChromaDB"]
F["🔤 BM25 Index"]
G["✅ Ready for Retrieval"]
A --> B
B --> C
C --> D
D --> E
C --> F
E --> G
F --> G
Not every query requires the RAG pipeline.
The Query Router classifies incoming requests and forwards them to the appropriate module.
| Query Type | Destination |
|---|---|
| Enterprise Knowledge | RAG Pipeline |
| Mathematical Expressions | Calculator Tool |
| Date & Time | Date/Time Tool |
| Web Queries | Web Search Tool |
flowchart TB
A["👤 User Query"]
B["🧭 Query Router"]
C["🧠 Enterprise RAG"]
D["🧮 Calculator"]
E["📅 Date & Time"]
F["🌐 Web Search"]
A --> B
B -->|Knowledge Query| C
B -->|Math Query| D
B -->|Date/Time| E
B -->|Web Query| F
RAGLink includes several optimizations to improve retrieval efficiency and reduce response latency.
- 🧠 Memory Cache
- ⚡ Redis Cache
- 🔄 Dynamic Index Updates
- 🎯 Hybrid Retrieval
- 📊 Cross-Encoder Reranking
- 🗜️ Context Compression
- 🛡️ Evidence Validation
These optimizations ensure fast, scalable, and reliable enterprise question answering.
RAGLink follows a modular architecture, where each module is responsible for a specific stage of the Retrieval-Augmented Generation (RAG) pipeline. This separation improves maintainability, scalability, and simplifies future enhancements.
RAGLink
│
├── accounts/ # User authentication & role management
│ ├── admin.py # Admin panel configuration
│ ├── forms.py # Authentication forms
│ ├── models.py # Custom User model
│ ├── urls.py # Authentication routes
│ ├── views.py # Login, logout & dashboard views
│ └── migrations/ # Database migrations
│
├── chatbot/ # Chat interface & conversation management
│ ├── services.py # Connects UI with the RAG pipeline
│ ├── views.py # Chat request handlers
│ ├── urls.py # Chat endpoints
│ └── models.py # Chat history
│
├── config/ # Django project configuration
│ ├── settings.py # Project settings
│ ├── urls.py # Root URL configuration
│ ├── wsgi.py # WSGI entry point
│ └── asgi.py # ASGI entry point
│
├── data/ # Generated indexes and retrieval data
│ ├── bm25.pkl # BM25 index
│ ├── chunks.pkl # Stored document chunks
│ └── chroma_db/ # Chroma vector database
│
├── documents/ # Enterprise document management
│ ├── admin.py # Admin configuration
│ ├── forms.py # Upload forms
│ ├── models.py # Document model
│ ├── urls.py # Document routes
│ ├── views.py # Upload/Delete operations
│ └── migrations/
│
├── media/
│ ├── Company/ # Company documents
│ └── Projects/ # Project documents
│
├── rag/ # Core Enterprise RAG System
│
│ ├── cache/ # Memory & Redis caching
│ │ ├── memory_cache.py
│ │ └── redis_cache.py
│ │
│ ├── chunking/ # Document chunking
│ │ └── chunker.py
│ │
│ ├── compression/ # Context compression
│ │ └── compressor.py
│ │
│ ├── embeddings/ # Embedding generation
│ │ └── embedding_model.py
│ │
│ ├── evaluation/ # Pipeline evaluation
│ │ └── metrics.py
│ │
│ ├── generation/ # Response generation
│ │ ├── citation.py
│ │ ├── context.py
│ │ ├── evidence_checker.py
│ │ ├── llm.py
│ │ └── prompt.py
│ │
│ ├── ingestion/ # Document indexing
│ │ ├── document_indexer.py
│ │ ├── dynamic_ingestion.py
│ │ ├── index_manager.py
│ │ └── loader.py
│ │
│ ├── langgraph/ # LangGraph workflow
│ │ ├── graph.py
│ │ ├── nodes.py
│ │ └── state.py
│ │
│ ├── query/ # Query processing
│ │ ├── query.py
│ │ └── rewrite.py
│ │
│ ├── query_understanding/ # Query understanding
│ │ ├── entity_normalizer.py
│ │ ├── intent_classifier.py
│ │ ├── query_expander.py
│ │ └── query_understanding.py
│ │
│ ├── refinement/ # Context refinement
│ │ └── context_refiner.py
│ │
│ ├── retrieval/ # Retrieval engine
│ │ ├── bm25.py
│ │ ├── hybrid.py
│ │ ├── rerank.py
│ │ ├── retrieval_planner.py
│ │ └── semantic.py
│ │
│ ├── tools/ # Utility tools
│ │ ├── calculator.py
│ │ ├── date.py
│ │ ├── time.py
│ │ ├── web_search.py
│ │ ├── document_lookup.py
│ │ └── query_router.py
│ │
│ ├── vectorstore/ # ChromaDB interface
│ │ └── chroma.py
│ │
│ ├── config.py # Pipeline configuration
│ └── pipeline.py # Main RAG pipeline
│
├── scripts/ # Helper scripts
├── templates/ # HTML templates
├── tests/ # Unit tests
├── requirements/ # Project dependencies
├── manage.py # Django entry point
└── README.md
| Module | Responsibility |
|---|---|
| accounts | Handles authentication, authorization, and role-based access control. |
| chatbot | Connects the user interface with the RAG pipeline and manages conversations. |
| documents | Uploads, stores, and manages enterprise documents. |
| media | Stores company and project documents used as the knowledge base. |
| cache | Improves performance using Memory and Redis caching. |
| chunking | Splits large documents into smaller chunks for retrieval. |
| compression | Reduces context size while preserving relevant information. |
| embeddings | Generates vector embeddings for semantic search. |
| generation | Builds prompts, validates evidence, and generates responses. |
| ingestion | Dynamically processes and indexes uploaded documents. |
| langgraph | Defines the workflow orchestration for the RAG pipeline. |
| query | Performs query rewriting and preprocessing. |
| query_understanding | Detects user intent, extracts entities, and expands queries. |
| refinement | Cleans and refines retrieved context before generation. |
| retrieval | Implements semantic search, BM25 retrieval, hybrid retrieval, and reranking. |
| tools | Provides utility tools such as calculator, date/time, and web search. |
| vectorstore | Handles storage and retrieval of embeddings using ChromaDB. |
| tests | Contains unit and integration tests for the project. |
The rag/ package is the heart of the application and is responsible for transforming enterprise documents into a searchable knowledge base.
Processes uploaded documents by extracting text, splitting it into chunks, generating embeddings, and updating retrieval indexes.
Analyzes user queries by identifying intent, extracting entities, rewriting queries, and expanding search terms.
Performs hybrid retrieval using semantic similarity (ChromaDB) and keyword search (BM25), followed by reranking.
Refines and compresses retrieved information to remove irrelevant content and reduce prompt size.
Constructs optimized prompts, validates retrieved evidence, and generates grounded responses using Groq Llama 3.1.
Coordinates the end-to-end workflow by connecting each stage of the RAG pipeline into a structured execution graph.
Before running the project, ensure the following are installed:
- Python 3.13+
- Git
- MySQL
- Groq API Key
- Virtual Environment (recommended)
git clone https://github.com/Srisilpa/RagLink.git
cd RagLinkpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements/requirements.txtCreate a .env file in the project root.
GROQ_API_KEY=your_groq_api_key
SECRET_KEY=your_django_secret_key
DB_NAME=raglink
DB_USER=root
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=3306python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverOpen your browser and visit
http://127.0.0.1:8000/
The system automatically processes uploaded enterprise documents.
- DOCX
- TXT
flowchart LR
A["Upload Document"]
-->
B["Extract Text"]
-->
C["Chunk Document"]
-->
D["Generate Embeddings"]
-->
E["Update ChromaDB"]
-->
F["Update BM25"]
-->
G["Available for Retrieval"]
The project includes unit tests for different RAG components.
Run all tests
python -m unittest discover testsRun a specific test
python -m unittest tests.test_pipelineExample test coverage includes
- Document Ingestion
- BM25 Retrieval
- Hybrid Retrieval
- Query Understanding
- Generation Pipeline
- Complete RAG Pipeline
The architecture is designed to support future extensions.
Planned improvements include:
- GraphRAG Integration
- Knowledge Graph Support
- Multi-modal RAG (Images & PDFs)
- Streaming Responses
- Voice Assistant
- Multi-language Support
- OCR for Scanned Documents
- Agentic Tool Calling
- Advanced Evaluation Metrics
- Source Citation Highlighting
- Conversation Memory
- Document Versioning
- Kubernetes Deployment
- CI/CD Pipeline
- Docker Compose Support
Contributions are welcome!
To contribute:
- Fork the repository.
- Create a feature branch.
git checkout -b feature/new-feature- Commit your changes.
git commit -m "Add new feature"- Push the branch.
git push origin feature/new-feature- Open a Pull Request.
✔ Enterprise-grade Django application
✔ Modular RAG Architecture
✔ Query Understanding Pipeline
✔ Intelligent Retrieval Planning
✔ Hybrid Retrieval (Semantic + BM25)
✔ Reciprocal Rank Fusion (RRF)
✔ Cross-Encoder Reranking
✔ Context Refinement
✔ Context Compression
✔ Evidence Validation
✔ Dynamic Document Ingestion
✔ ChromaDB Integration
✔ Groq Llama 3.1 Integration
✔ LangGraph Workflow
✔ Role-Based Authentication
✔ Memory & Redis Cache
✔ Unit Testing
✔ Extensible Architecture
Sri Silpa
B.Tech Information Technology
Shri Vishnu Engineering College for Women
GitHub: https://github.com/Srisilpa
This project is licensed under the MIT License.
Feel free to use, modify, and distribute this project for educational and research purposes.
This project leverages several open-source technologies:
- Django
- LangChain
- LangGraph
- Groq
- ChromaDB
- HuggingFace
- BM25
- Python
Special thanks to the open-source community for providing the tools and frameworks that made this project possible.