GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - YasirAwan4831/nexeagent-rag-based-knowledge-assistant: A production-style RAG-based AI Knowledge Assistnt developed during the AI & Automation Internship at NEXEAGENT. The system securely uploads company documents, generates semantic embeddings, stores contextual knowledge in a vector database, and delivers accurate AI-powered responses using Google Gemini, (RAG) & intelligent vector Search pipelines.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
backend
backend
 
 
frontend
frontend
 
 
.gitignore
.gitignore
 
 
API.md
API.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
y
y
 
 

Repository files navigation

Typing SVG

Python FastAPI React Vite

Google Gemini ChromaDB Tailwind CSS License: MIT

PRs Welcome Made with โค๏ธ Internship Status


๐Ÿš€ A production-grade AI Knowledge Assistant โ€” Upload company documents, generate intelligent embeddings, and get contextual AI-powered answers. Think ChatGPT, but trained exclusively on your documents.



๐Ÿงญ Quick Navigation

Section Link
๐ŸŒŸ Features View Features
๐Ÿ—๏ธ Architecture View Architecture
โšก Quick Start Get Started
๐Ÿ”Œ API Reference View API
๐Ÿ“ Project Structure View Structure
๐Ÿ› ๏ธ Tech Stack View Stack
๐Ÿš€ Deployment Deploy
๐Ÿค Contributing Contribute


๐Ÿ“– Project Overview

NEXEAGENT RAG Knowledge Assistant is a full-stack, production-style AI application that transforms static company documents into a dynamic, conversational knowledge base.

Built on the Retrieval-Augmented Generation (RAG) paradigm, it combines the power of Google Gemini AI with a ChromaDB vector database to deliver precise, document-grounded answers โ€” no hallucinations, no guesswork.

Think of it as ChatGPT, but trained on your company's internal knowledge โ€” policies, manuals, reports, and more.

Developed as part of the AI & Automation Internship at NEXE.AGENT

๐Ÿ“„ Upload Documents
        โ†“
๐Ÿ” Extract & Chunk Text
        โ†“
๐Ÿงฎ Generate Embeddings
        โ†“
๐Ÿ—„๏ธ Store in ChromaDB
        โ†“
๐Ÿ’ฌ User Asks Question
        โ†“
๐Ÿ”Ž Vector Similarity Search
        โ†“
๐Ÿค– Gemini Generates Answer
        โ†“
โœ… Contextual Response


๐ŸŒŸ Features

๐Ÿ—‚๏ธ Document Management ๐Ÿค– AI Intelligence ๐Ÿ’ป Developer Experience
PDF, TXT, DOCX upload Google Gemini 2.0 Flash FastAPI + Swagger docs
Drag & drop interface Context-aware answers Hot reload dev server
Document indexing Streaming AI responses Clean REST API design
View & delete docs No hallucinations Pytest test suite
Metadata tracking Source attribution Modular architecture

๐Ÿ”‘ Core Feature Details

๐Ÿ“ค Intelligent Document Upload System
  • Multi-format support: PDF, TXT, DOCX with automatic format detection
  • Drag & Drop UI: Modern React-based file upload with progress indicators
  • Validation: File type and size validation before processing
  • Persistent storage: Files stored locally with JSON metadata tracking
  • Batch processing: Upload and process multiple documents simultaneously
๐Ÿงฎ Advanced RAG Pipeline
  • Smart chunking: Configurable chunk sizes (default: 800 tokens) with overlap (150 tokens)
  • Gemini Embeddings: Uses models/text-embedding-004 for high-quality vector representations
  • ChromaDB storage: Persistent vector store with fast similarity search
  • TOP-K Retrieval: Configurable result count for optimal context assembly
  • Context assembly: Intelligent merging of retrieved chunks for coherent prompting
๐Ÿ’ฌ AI Chat Interface
  • Session-based history: Persistent chat conversations per session
  • Context injection: Retrieved document chunks automatically injected into prompts
  • Streaming responses: Real-time token streaming for responsive UX
  • Source transparency: Answers cite which documents were used
  • Fallback handling: Graceful responses when no relevant documents found
๐Ÿ“Š Modern Dashboard
  • React + Vite: Lightning-fast development and build times
  • Tailwind CSS: Utility-first styling with dark mode support
  • Framer Motion: Smooth animations and page transitions
  • Responsive layout: Works on desktop, tablet, and mobile
  • Real-time stats: Document count, index status, query metrics


๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        NEXEAGENT SYSTEM ARCHITECTURE                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚   REACT FRONTEND      โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚      FASTAPI BACKEND         โ”‚    โ”‚
โ”‚   โ”‚                      โ”‚  HTTP   โ”‚                              โ”‚    โ”‚
โ”‚   โ”‚  โ€ข Upload Page       โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ€ข /api/upload               โ”‚    โ”‚
โ”‚   โ”‚  โ€ข Chat Interface    โ”‚  REST   โ”‚  โ€ข /api/documents            โ”‚    โ”‚
โ”‚   โ”‚  โ€ข Documents Page    โ”‚         โ”‚  โ€ข /api/chat                 โ”‚    โ”‚
โ”‚   โ”‚  โ€ข Settings Page     โ”‚         โ”‚  โ€ข /api/health               โ”‚    โ”‚
โ”‚   โ”‚  โ€ข Dashboard/Home    โ”‚         โ”‚                              โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                               โ”‚                        โ”‚
โ”‚                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚                          โ”‚                    โ”‚                  โ”‚     โ”‚
โ”‚                    โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”‚
โ”‚                    โ”‚ RAG SERVICE โ”‚    โ”‚ GEMINI SERVICE  โ”‚  โ”‚  VECTOR  โ”‚ โ”‚
โ”‚                    โ”‚            โ”‚    โ”‚                โ”‚  โ”‚  STORE   โ”‚ โ”‚
โ”‚                    โ”‚ โ€ข Chunking โ”‚    โ”‚ โ€ข Embeddings   โ”‚  โ”‚          โ”‚ โ”‚
โ”‚                    โ”‚ โ€ข Pipeline โ”‚    โ”‚ โ€ข Chat/LLM     โ”‚  โ”‚ ChromaDB โ”‚ โ”‚
โ”‚                    โ”‚ โ€ข Context  โ”‚    โ”‚ โ€ข Streaming    โ”‚  โ”‚  SQLite  โ”‚ โ”‚
โ”‚                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                                                                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚   โ”‚                        DATA LAYER                                โ”‚ โ”‚
โ”‚   โ”‚  ๐Ÿ“ data/uploads/  โ”‚  ๐Ÿ—„๏ธ data/chroma/  โ”‚  ๐Ÿ“‹ data/metadata/    โ”‚ โ”‚
โ”‚   โ”‚  ๐Ÿ“œ data/chat_history/  โ”‚  ๐Ÿ“ data/logs/                        โ”‚ โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ RAG Pipeline Deep Dive

INGESTION PHASE
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿ“„ Raw Document
    โ”‚
    โ–ผ
๐Ÿ“ Text Extraction (PDF/DOCX/TXT parsers)
    โ”‚
    โ–ผ
โœ‚๏ธ  Smart Chunking  โ”€โ”€โ”€โ”€ chunk_size: 800 tokens
    โ”‚                    chunk_overlap: 150 tokens
    โ–ผ
๐Ÿงฎ Gemini Embedding Generation (text-embedding-004)
    โ”‚
    โ–ผ
๐Ÿ—„๏ธ  ChromaDB Vector Storage  โ”€โ”€โ”€โ”€ Persistent SQLite backend


QUERY PHASE
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿ’ฌ User Query
    โ”‚
    โ–ผ
๐Ÿงฎ Query Embedding Generation
    โ”‚
    โ–ผ
๐Ÿ”Ž Cosine Similarity Search (TOP-K=5)
    โ”‚
    โ–ผ
๐Ÿ“‹ Context Assembly (retrieved chunks)
    โ”‚
    โ–ผ
๐Ÿค– Gemini LLM  โ”€โ”€โ”€โ”€ System prompt + Context + Query
    โ”‚
    โ–ผ
โœ… Grounded, Accurate Answer


๐Ÿ“ Project Structure

nexeagent-rag-knowledge-assistant/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ README.md                      # You are here
โ”œโ”€โ”€ ๐Ÿ“„ API.md                         # Full API documentation
โ”œโ”€โ”€ ๐Ÿ” .env                           # Root env (optional)
โ”‚
โ”œโ”€โ”€ ๐Ÿ backend/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ run.py                     # Entry point โ€” starts Uvicorn server
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt           # Python dependencies
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ pytest.ini                 # Test configuration
โ”‚   โ”œโ”€โ”€ ๐Ÿ” .env                       # Backend environment variables
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฆ app/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ main.py                # FastAPI app initialization + CORS
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ config.py              # Settings loader (env vars)
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ”Œ api/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ routes/
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ chat.py        # POST /api/chat endpoint
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ documents.py   # GET/DELETE /api/documents
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ upload.py      # POST /api/upload endpoint
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ ๐Ÿ“„ health.py      # GET /api/health
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿง  services/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ rag_service.py         # Core RAG orchestration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ gemini_service.py      # Google Gemini API client
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ embedding_service.py   # Embedding generation
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ vector_store_service.py# ChromaDB operations
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ retrieval_service.py   # Similarity search logic
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ query_service.py       # Query processing pipeline
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ pdf_service.py         # Document text extraction
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ models/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ schemas.py         # Pydantic request/response models
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ› ๏ธ  utils/
โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ chunking.py        # Text chunking strategies
โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ file_utils.py      # File I/O helpers
โ”‚   โ”‚       โ””โ”€โ”€ ๐Ÿ“„ logger.py          # Structured logging setup
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฆ data/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ uploads/               # Raw uploaded documents
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ—„๏ธ  chroma/               # ChromaDB vector store files
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ chroma.sqlite3
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“‹ metadata/              # Document metadata (JSON)
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ’ฌ chat_history/          # Saved chat sessions (JSON)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ logs/                      # Application logs
โ”‚   โ”œโ”€โ”€ ๐Ÿ“š sample_docs/
โ”‚   โ”‚   โ””โ”€โ”€ company_policy.txt        # Sample document for testing
โ”‚   โ””โ”€โ”€ ๐Ÿงช tests/
โ”‚       โ”œโ”€โ”€ test_api.py               # API endpoint tests
โ”‚       โ””โ”€โ”€ test_chunking.py          # Chunking logic tests
โ”‚
โ””โ”€โ”€ โš›๏ธ  frontend/
    โ”œโ”€โ”€ ๐Ÿ“„ index.html                 # Root HTML template
    โ”œโ”€โ”€ ๐Ÿ“„ package.json               # Node.js dependencies
    โ”œโ”€โ”€ ๐Ÿ“„ vite.config.js             # Vite build configuration
    โ”œโ”€โ”€ ๐Ÿ“„ tailwind.config.js         # Tailwind CSS configuration
    โ”œโ”€โ”€ ๐Ÿ“„ postcss.config.js          # PostCSS configuration
    โ”‚
    โ””โ”€โ”€ ๐Ÿ“ฆ src/
        โ”œโ”€โ”€ ๐Ÿ“„ App.jsx                # Root React component + routing
        โ”œโ”€โ”€ ๐Ÿ“„ main.jsx               # React DOM entry point
        โ”œโ”€โ”€ ๐Ÿ“„ index.css              # Global styles + Tailwind imports
        โ”‚
        โ”œโ”€โ”€ ๐Ÿงฉ components/
        โ”‚   โ”œโ”€โ”€ ChatMessage.jsx       # Individual chat bubble component
        โ”‚   โ”œโ”€โ”€ FileUpload.jsx        # Drag & drop upload component
        โ”‚   โ”œโ”€โ”€ Layout.jsx            # App shell with sidebar
        โ”‚   โ”œโ”€โ”€ LoadingSpinner.jsx    # Animated loading indicator
        โ”‚   โ”œโ”€โ”€ Sidebar.jsx           # Navigation sidebar
        โ”‚   โ”œโ”€โ”€ StatCard.jsx          # Dashboard stat display card
        โ”‚   โ””โ”€โ”€ TypingIndicator.jsx   # AI "thinking" animation
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“„ context/
        โ”‚   โ””โ”€โ”€ ThemeContext.jsx      # Dark/light mode context
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“„ pages/
        โ”‚   โ”œโ”€โ”€ Home.jsx              # Dashboard with stats overview
        โ”‚   โ”œโ”€โ”€ Chat.jsx              # Main AI chat interface
        โ”‚   โ”œโ”€โ”€ Documents.jsx         # Document library & management
        โ”‚   โ”œโ”€โ”€ Upload.jsx            # File upload workflow page
        โ”‚   โ””โ”€โ”€ Settings.jsx          # App configuration page
        โ”‚
        โ””โ”€โ”€ ๐Ÿ“„ services/
            โ””โ”€โ”€ api.js                # Axios API client + all endpoints


โšก Quick Start

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have:

Requirement Version Download
Python 3.11+ python.org
Node.js 18+ nodejs.org
Google Gemini API Key โ€” aistudio.google.com
Git Latest git-scm.com

1๏ธโƒฃ Clone the Repository

git clone https://github.com/YOUR_USERNAME/nexeagent-rag-knowledge-assistant.git
cd nexeagent-rag-knowledge-assistant

2๏ธโƒฃ Backend Setup

# Navigate to backend
cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
copy .env.example .env      # Windows
# cp .env.example .env      # macOS/Linux

Edit backend/.env with your API key:

# โ”€โ”€ Google Gemini โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
GEMINI_API_KEY=your_actual_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
GEMINI_EMBEDDING_MODEL=models/text-embedding-004

# โ”€โ”€ RAG Configuration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
CHUNK_SIZE=800
CHUNK_OVERLAP=150
TOP_K_RESULTS=5

# โ”€โ”€ Server โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
HOST=0.0.0.0
PORT=8000
DEBUG=false

Start the backend server:

python run.py

โœ… API running at http://localhost:8000

๐Ÿ“š Swagger docs at http://localhost:8000/docs

๐Ÿ“– ReDoc at http://localhost:8000/redoc


3๏ธโƒฃ Frontend Setup

Open a new terminal:

# Navigate to frontend
cd frontend

# Install dependencies
npm install

# Start dev server
npm run dev

โœ… Frontend running at http://localhost:5173


4๏ธโƒฃ Test the Full RAG Pipeline

1. Open http://localhost:5173
2. Navigate to โ†’ Upload
3. Upload the sample file: backend/sample_docs/company_policy.txt
4. Wait for indexing to complete โœ…
5. Navigate to โ†’ Chat
6. Ask: "What is the refund policy?"
7. Receive a grounded AI answer from your document ๐ŸŽ‰


๐Ÿ”ง Environment Variables Reference

Variable Description Default Required
GEMINI_API_KEY Google Gemini API authentication key โ€” โœ… Yes
GEMINI_MODEL Chat/generation model ID gemini-2.0-flash โœ… Yes
GEMINI_EMBEDDING_MODEL Embedding model ID models/text-embedding-004 โœ… Yes
CHUNK_SIZE Token count per text chunk 800 โŒ No
CHUNK_OVERLAP Overlap tokens between chunks 150 โŒ No
TOP_K_RESULTS Number of chunks retrieved per query 5 โŒ No
HOST Backend server host 0.0.0.0 โŒ No
PORT Backend server port 8000 โŒ No
DEBUG Enable debug mode false โŒ No


๐Ÿ”Œ API Reference

Base URL

http://localhost:8000

Endpoints


๐ŸŸข GET /api/health

Check if the API is alive.

Response:

{
  "status": "healthy",
  "version": "1.0.0",
  "timestamp": "2024-01-15T10:30:00Z"
}

๐Ÿ“ค POST /api/upload

Upload and index a document into the RAG pipeline.

Request: multipart/form-data

Field Type Description
file File PDF, TXT, or DOCX file

Response:

{
  "success": true,
  "document_id": "doc_abc123",
  "filename": "company_policy.txt",
  "chunks_created": 14,
  "message": "Document indexed successfully"
}

๐Ÿ’ฌ POST /api/chat

Send a message and receive an AI-generated, document-grounded response.

Request Body:

{
  "message": "What is the refund policy?",
  "session_id": "session_xyz789",
  "stream": false
}

Response:

{
  "answer": "According to the company policy document, refunds are processed within 7-10 business days...",
  "sources": ["company_policy.txt"],
  "session_id": "session_xyz789",
  "tokens_used": 342
}

๐Ÿ“‹ GET /api/documents

Retrieve a list of all indexed documents.

Response:

{
  "documents": [
    {
      "id": "doc_abc123",
      "filename": "company_policy.txt",
      "size_bytes": 24310,
      "chunks": 14,
      "uploaded_at": "2024-01-15T10:00:00Z",
      "status": "indexed"
    }
  ],
  "total": 1
}

๐Ÿ—‘๏ธ DELETE /api/documents/{document_id}

Remove a document and its vectors from the knowledge base.

Response:

{
  "success": true,
  "message": "Document doc_abc123 deleted successfully"
}

๐Ÿ” GET /api/documents/{document_id}

Retrieve metadata for a specific document.

Response:

{
  "id": "doc_abc123",
  "filename": "company_policy.txt",
  "chunks": 14,
  "status": "indexed",
  "uploaded_at": "2024-01-15T10:00:00Z"
}


๐Ÿ› ๏ธ Tech Stack

Frontend Layer

Technology Version Purpose
โš›๏ธ React.js 18+ UI component framework
โšก Vite 5+ Build tool & dev server
๐ŸŽจ Tailwind CSS 3.x Utility-first styling
๐ŸŽญ Framer Motion 11+ Animations & transitions
๐Ÿ”— Axios 1.x HTTP client for API calls
๐ŸŽฏ Lucide React Latest Icon library

Backend Layer

Technology Version Purpose
๐Ÿ Python 3.11+ Core runtime language
๐Ÿš€ FastAPI 0.110+ Async REST API framework
๐Ÿฆ„ Uvicorn Latest ASGI server
๐Ÿ” Pydantic 2.x Data validation & schemas

AI & Machine Learning Layer

Technology Version Purpose
๐Ÿค– Google Gemini 2.0 Flash LLM for chat responses
๐Ÿงฎ Gemini Embeddings text-embedding-004 Vector generation
๐Ÿ—„๏ธ ChromaDB Latest Vector database

Storage & Infrastructure

Technology Purpose
๐Ÿ“ Local Filesystem Raw document storage
๐Ÿ—ƒ๏ธ SQLite ChromaDB backend
๐Ÿ“‹ JSON Metadata & chat history


๐Ÿ–ฅ๏ธ Frontend Pages

Page Route Description
๐Ÿ  Home / Dashboard / System stats, quick actions, overview
๐Ÿ’ฌ Chat /chat AI conversation interface with history
๐Ÿ“ค Upload /upload Drag & drop document upload
๐Ÿ“š Documents /documents Document library, index status, delete
โš™๏ธ Settings /settings API keys, model config, preferences


๐Ÿงช Running Tests

# Navigate to backend
cd backend

# Activate virtual environment
venv\Scripts\activate    # Windows
source venv/bin/activate # macOS/Linux

# Run all tests
pytest tests/ -v

# Run specific test file
pytest tests/test_api.py -v
pytest tests/test_chunking.py -v

# Run with coverage report
pytest tests/ -v --cov=app --cov-report=html

Test Coverage:

Test File Tests Coverage
test_api.py API endpoint validation Upload, Chat, Documents, Health routes
test_chunking.py Text processing logic Chunking strategies, overlap, edge cases


๐Ÿ“ธ Screenshots

๐Ÿ’ก Add your screenshots here after running the project locally.

Dashboard Chat Interface
[dashboard-screenshot.png] [chat-screenshot.png]
Document Upload Document Library
[upload-screenshot.png] [documents-screenshot.png]


๐Ÿš€ Deployment

๐Ÿณ Docker Deployment (Recommended)

Create a docker-compose.yml:

version: '3.8'

services:
  backend:
    build: ./backend
    ports:
      - "8000:8000"
    env_file:
      - ./backend/.env
    volumes:
      - ./backend/data:/app/data

  frontend:
    build: ./frontend
    ports:
      - "80:80"
    depends_on:
      - backend
docker-compose up --build

โ˜๏ธ Cloud Deployment Options

Platform Backend Frontend
Railway โœ… Python/FastAPI โœ… Static
Render โœ… Python service โœ… Static site
Vercel โŒ (use separate) โœ… Best for React
Fly.io โœ… Docker support โœ… Docker support
AWS EC2 โœ… Full control โœ… Full control

๐Ÿ“ฆ Production Build

# Frontend production build
cd frontend
npm run build
# Output in: frontend/dist/

# Backend production start
cd backend
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4


๐Ÿ” Security Notes

โš ๏ธ Important security considerations for production deployment:

  • ๐Ÿ”‘ Never commit .env files to version control โ€” use .gitignore
  • ๐Ÿ›ก๏ธ CORS Configuration โ€” Restrict allow_origins to your actual frontend domain in production
  • ๐Ÿ”’ API Key Rotation โ€” Regularly rotate your Gemini API key
  • ๐Ÿ“ File Size Limits โ€” Configure upload limits to prevent resource exhaustion
  • ๐Ÿšซ Rate Limiting โ€” Add rate limiting to chat and upload endpoints
  • ๐Ÿ—‚๏ธ File Type Validation โ€” Only allow PDF, TXT, DOCX; reject executable files
  • ๐Ÿ” Auth Layer โ€” Add JWT authentication before exposing to public internet


๐Ÿ”ฎ Future Improvements

Planned Roadmap
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Phase 2 โ€” Enhanced Intelligence
  โ–ก Multi-document cross-referencing
  โ–ก Streaming responses with SSE
  โ–ก Source highlighting in responses
  โ–ก Confidence scores for answers

Phase 3 โ€” Enterprise Features
  โ–ก User authentication (JWT)
  โ–ก Role-based access control
  โ–ก Multi-tenant document namespacing
  โ–ก Audit logging for compliance

Phase 4 โ€” Scale & Performance
  โ–ก Redis for chat session caching
  โ–ก Celery for async document processing
  โ–ก PostgreSQL for metadata (replace JSON)
  โ–ก S3-compatible cloud document storage

Phase 5 โ€” Advanced AI
  โ–ก Model switching (OpenAI, Anthropic, local LLMs)
  โ–ก Fine-tuned domain-specific embeddings
  โ–ก Document summarization pipeline
  โ–ก Automated knowledge graph extraction


๐Ÿค Contributing

Contributions are welcome! Follow these steps:

# 1. Fork the repository on GitHub

# 2. Clone your fork
git clone https://github.com/YasirAwan4831/nexeagent-rag-knowledge-assistant.git

# 3. Create a feature branch
git checkout -b feature/amazing-feature

# 4. Make your changes and commit
git add .
git commit -m "feat: add amazing feature"

# 5. Push to your fork
git push origin feature/amazing-feature

# 6. Open a Pull Request on GitHub

Commit Message Convention

feat:     New feature
fix:      Bug fix
docs:     Documentation update
style:    Code formatting (no logic change)
refactor: Code restructuring
test:     Adding tests
chore:    Build or config changes


๐Ÿ“„ License

MIT License

Copyright (c) 2026 Muhammad Yasir โ€” NEXE.AGENT Internship

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense and/or sell
copies of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.

See the full LICENSE file for details.



๐Ÿ‘ค About the Developer

Platform Link
๐ŸŒ Portfolio yasirawaninfo.vercel.app
๐Ÿ’ผ LinkedIn linkedin.com/in/yasirawan4831
โ–ถ๏ธ YouTube youtube.com/@YasirTech-t1d
๐Ÿ™ GitHub github.com/YasirAwan4831
๐Ÿฆ X (Twitter) x.com/yasirawan4831
๐Ÿ“ธ Instagram instagram.com/yasirawan4831
๐Ÿ”— Linktree yasirawan4831.github.io/futuristic-links-dashboard
๐Ÿ“ง Email [email protected]


๐Ÿ™ Acknowledgements

  • NEXE.AGENT โ€” For the AI & Automation Internship opportunity
  • Google Gemini โ€” For the powerful LLM and embedding APIs
  • ChromaDB โ€” For the excellent open-source vector database
  • FastAPI โ€” For the elegant Python API framework
  • Shields.io โ€” For the beautiful README badges
  • Capsule Render โ€” For the SVG banner animations
  • Readme Typing SVG โ€” For the typing animation

โญ If this project helped you, please consider giving it a star!

About

A production-style RAG-based AI Knowledge Assistnt developed during the AI & Automation Internship at NEXEAGENT. The system securely uploads company documents, generates semantic embeddings, stores contextual knowledge in a vector database, and delivers accurate AI-powered responses using Google Gemini, (RAG) & intelligent vector Search pipelines.

Topics

aiai-toolsembeddings-modelgoogle-geminigoogle-gemini-api-keyknowledge-based-aiknowledge-based-systemspythonragrag-pipelinesemantic-search-enginesemantic-search-in-nlpvector-databasevector-databases-chroma

Resources

Readme
License
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.