Intelligent Documentation Assistant
A modern RAG (Retrieval-Augmented Generation) chatbot system that provides intelligent answers about AWS services using advanced AI technology, featuring document processing, semantic search, and a beautiful web interface.
- π§ Intelligent Q&A - Advanced RAG system for AWS documentation queries
- οΏ½ Document Processing - Automated PDF parsing and text chunking
- οΏ½ Semantic Search - Vector-based similarity search with ChromaDB
- π¬ Modern Chat Interface - Elegant, responsive web UI with real-time chat
- π Source Attribution - Detailed source references with confidence scores
- β‘ Local AI Models - Powered by Ollama for privacy and performance
- π¨ Beautiful UI - Glassmorphism design with smooth animations
- οΏ½ Responsive Design - Works perfectly on desktop, tablet, and mobile
Backend: Python 3.8+, Flask, LangChain, ChromaDB
Frontend: Next.js 15, TypeScript, Tailwind CSS, React
AI/ML: Ollama, nomic-embed-text, Mistral LLM
Vector Database: ChromaDB with persistence
Document Processing: PyPDF, LangChain Text Splitters
API: RESTful API with CORS support
The system follows a modern RAG (Retrieval-Augmented Generation) architecture:
- οΏ½ Document Loader - PDF processing and text extraction from AWS documentation
- βοΈ Text Splitter - Intelligent chunking with overlap for context preservation
- οΏ½ Embedding Function - Vector embeddings using nomic-embed-text model
- ποΈ Vector Database - ChromaDB for efficient similarity search
- π€ LLM Integration - Mistral model via Ollama for response generation
- π Web Interface - Next.js frontend with real-time chat capabilities
- οΏ½ Document Ingestion - PDF documents are loaded and processed
- β‘ Text Processing - Documents are split into overlapping chunks
- π’ Vectorization - Text chunks are converted to vector embeddings
- οΏ½ Storage - Vectors and metadata stored in ChromaDB
- οΏ½ Query Processing - User queries are embedded and matched against stored vectors
- π€ Response Generation - Retrieved context is used to generate accurate responses
- οΏ½ UI Display - Results shown with sources and confidence scores
- Python 3.8+
- Node.js 18+
- Ollama installed locally
- Git
- Clone the repository
git clone https://github.com/Haythem532002/RAG-Chatbot.git
cd RAG-Chatbot- Set up Python virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install Python dependencies
pip install -r requirements.txt- Install and setup Ollama models
# Install Ollama (if not already installed)
curl -fsSL https://ollama.ai/install.sh | sh
# Pull required models
ollama pull nomic-embed-text
ollama pull mistral- Process your documents (one-time setup)
python load_data.py --reset- Start the Flask backend
python flask_backend.pyThe backend will be available at http://localhost:5000
- Navigate to frontend directory
cd rag-chatbot-frontend- Install frontend dependencies
npm install- Start the Next.js development server
npm run devThe frontend will be available at http://localhost:3000
Test the system via command line:
python query_data.py "What is Amazon EC2?"Or test the API directly:
curl -X POST http://localhost:5000/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "What is AWS Lambda?"}'- π Web Interface: http://localhost:3000
- οΏ½ Flask API: http://localhost:5000
- οΏ½ Health Check: http://localhost:5000/
- οΏ½ Chat API: http://localhost:5000/api/chat
- π€ Ollama Server: http://localhost:11434
RAG-Chatbot/
βββ data/ # Source documents directory
β βββ AWS Certified Cloud Practitioner Slides v2.11.0.pdf
β βββ aws-overview.pdf
βββ rag/ # Project screenshots
β βββ Capture d'Γ©cran 2025-10-02 115121.png
β βββ Capture d'Γ©cran 2025-10-02 140024.png
βββ chroma/ # ChromaDB persistence directory
β βββ [vector database files]
βββ rag-chatbot-frontend/ # Next.js frontend application
β βββ src/
β β βββ app/ # Next.js App Router
β β β βββ globals.css # Global styles and animations
β β β βββ layout.tsx # Root layout with metadata
β β β βββ page.tsx # Main chat page
β β βββ components/
β β βββ ChatInterface.tsx # Main chat component
β βββ package.json
β βββ tailwind.config.js
βββ load_data.py # Document processing and vectorization
βββ query_data.py # Query processing and RAG pipeline
βββ embedding_function.py # Ollama embedding integration
βββ flask_backend.py # REST API server
βββ requirements.txt # Python dependencies
βββ venv/ # Python virtual environment
βββ __pycache__/ # Python cache files
βββ .git/ # Git repository
βββ .gitignore # Git ignore file
βββ README.md # Project documentation
- π Document Sources: Add your own PDFs to the
data/directory - π¨ UI Themes: Modify Tailwind classes in
globals.css - π€ Models: Change embedding or LLM models in configuration
- π Chunk Settings: Adjust chunk size and overlap for different document types
- π Search Parameters: Modify similarity thresholds and result counts
POST /api/chat
{
"message": "What is Amazon S3?"
}Response:
{
"response": "Amazon S3 (Simple Storage Service) is...",
"sources": ["data/aws-overview.pdf:15:0", "data/aws-overview.pdf:16:1"],
"context": [
{
"content": "Amazon S3 provides...",
"source": "data/aws-overview.pdf:15:0",
"score": 0.85,
"page": "15",
"file": "data/aws-overview.pdf"
}
],
"num_sources": 2,
"query": "What is Amazon S3?",
"status": "success"
}GET /
{
"status": "healthy",
"message": "RAG Chatbot API is running",
"endpoints": {
"chat": "POST /api/chat",
"health": "GET /"
}
}# Comprehensive embedding tests
python test_embeddings.py
# Quick functionality test
python quick_test.py# Test document loading
python load_data.py
# Test query processing
python query_data.py "test query"
# Test embedding function
python -c "from embedding_function import create_embedding_function; print('Embeddings OK')"- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Install development dependencies (
pip install -r requirements-dev.txt) - Make your changes with proper tests
- Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 for Python code
- Use TypeScript for frontend development
- Write tests for new features
- Update documentation for API changes
- Use conventional commits for clear history
- β‘ Response Times: Typical query response under 2-3 seconds
- π― Accuracy: High-quality responses with source attribution
- οΏ½ Storage: Efficient vector storage with ChromaDB
- π Search Quality: Semantic similarity matching with confidence scores
- οΏ½ UI Performance: Optimized React components with smooth animations
This project is licensed under the MIT License. See the LICENSE file for details.
- π¦ LangChain for the excellent RAG framework
- π€ Ollama for local AI model hosting
- β‘ Next.js for the amazing React framework
- π¨ Tailwind CSS for beautiful styling utilities
- π ChromaDB for efficient vector storage
Built with β€οΈ using Modern AI & RAG Architecture

