Thanks to visit codestin.com
Credit goes to github.com

Skip to content

roe-ai/vectorless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

33 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Vectorless PDF Chatbot

A revolutionary PDF chatbot that uses no vector embeddings or traditional RAG. Instead, it leverages Large Language Models for intelligent document selection and page relevance detection, providing a completely stateless and privacy-first experience.

๐Ÿš€ What Makes This "Vectorless"?

Traditional PDF chatbots convert documents into vector embeddings for semantic search. This approach:

  • โŒ Requires expensive vector databases
  • โŒ Needs pre-processing and indexing
  • โŒ Stores document data on servers
  • โŒ Loses context and nuance in embeddings

Our Vectorless approach:

  • โœ… Uses LLM reasoning instead of vectors
  • โœ… Processes documents in real-time
  • โœ… Completely stateless - no server storage
  • โœ… Preserves full document context
  • โœ… Privacy-first - documents stay in your browser

๐Ÿง  How the Vectorless Process Works

3-Step Intelligent Document Analysis

graph TD
    A[๐Ÿ“„ User uploads PDFs] --> B[๐Ÿง  LLM Document Selection]
    B --> C[๐ŸŽฏ LLM Page Relevance Detection]
    C --> D[๐Ÿ’ฌ Contextual Answer Generation]
    
    B --> B1[Analyzes collection description<br/>+ document filenames<br/>+ user question]
    C --> C1[Examines actual page content<br/>from selected documents<br/>in parallel processing]
    D --> D1[Generates comprehensive answer<br/>with proper citations]
Loading

Step 1: ๐Ÿง  Smart Document Selection

  • LLM reads your collection description and document filenames
  • Intelligently selects which documents are likely to contain relevant information
  • No embeddings needed - uses reasoning and context understanding

Step 2: ๐ŸŽฏ Page Relevance Detection

  • LLM examines actual page content from selected documents
  • Processes multiple documents in parallel for speed
  • Identifies the most relevant pages based on question context

Step 3: ๐Ÿ’ฌ Contextual Answer Generation

  • Uses only the relevant pages to generate accurate answers
  • Maintains full document context and nuance
  • Provides proper citations and references

โœจ Key Features

๐Ÿ”’ Privacy-First & Stateless

  • Zero Server Storage: Documents processed and stored entirely in your browser
  • LocalStorage Persistence: Your documents persist across browser sessions
  • No Data Leakage: Document content never persists on servers
  • Serverless-Friendly: Perfect for Vercel/Netlify deployments

๐Ÿ“ Advanced File Handling

  • Up to 100 PDF documents per session
  • Chunked Upload System: Automatically handles large file sets (>4.5MB)
  • 4.5MB per file limit - processes substantial documents
  • Real-time Processing: No pre-indexing required

๐Ÿ’ก Intelligent Processing

  • Multi-Model Support: GPT-4, GPT-5-mini, and more
  • Parallel Processing: Multiple documents analyzed simultaneously
  • Context Preservation: Full document context maintained throughout
  • Dynamic Descriptions: Edit collection descriptions anytime

๐ŸŽจ Modern Interface

  • Responsive Design: Works on desktop and mobile
  • Real-time Progress: Visual feedback during uploads and processing
  • GitHub Integration: Easy access to source code
  • Error Handling: Comprehensive error messages and recovery

๐Ÿ›  Technology Stack

Frontend

  • Next.js 15: React framework with App Router
  • TypeScript: Type safety and better development experience
  • Tailwind CSS: Modern utility-first styling
  • Lucide React: Beautiful, consistent icons

Backend (Vercel Functions)

  • Python Functions: Serverless API endpoints
  • PyPDF2: Reliable PDF text extraction
  • OpenAI GPT: Advanced language models for reasoning
  • Chunked Processing: Handle large uploads efficiently

Infrastructure

  • Vercel Deployment: Seamless serverless hosting
  • No Databases: Completely stateless architecture
  • Automatic Scaling: Handle traffic spikes effortlessly

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • OpenAI API key

1. Clone and Install

git clone https://github.com/roe-ai/vectorless-chatbot.git
cd vectorless-chatbot
npm install

2. Environment Setup

Create .env.local:

# Only needed for local development
OPENAI_API_KEY=your_openai_api_key_here

3. Run Locally

npm run dev

Visit http://localhost:3000

4. Deploy to Vercel

  1. Push to GitHub
  2. Connect to Vercel
  3. Set environment variable: OPENAI_API_KEY=your_key
  4. Deploy! โœ…

๐Ÿ“– How to Use

1. Upload Your Documents

  • Click "Add Your First Document" or "Add Files"
  • Select up to 100 PDF files (4.5MB each max)
  • Add a description of your document collection
  • Large uploads are automatically chunked for reliability

2. Start Chatting

  • Ask questions about your documents in natural language
  • Watch the 3-step process: Document Selection โ†’ Page Detection โ†’ Answer Generation
  • Get detailed answers with timing and cost breakdowns

3. Manage Your Collection

  • Add more documents anytime
  • Edit collection descriptions
  • Start new sessions as needed
  • All data stays in your browser

๐Ÿ— Architecture Deep Dive

Stateless Design

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Browser       โ”‚    โ”‚  Vercel Functions โ”‚    โ”‚   OpenAI API    โ”‚
โ”‚                 โ”‚    โ”‚                  โ”‚    โ”‚                 โ”‚
โ”‚ โ€ข LocalStorage  โ”‚โ—„โ”€โ”€โ–บโ”‚ โ€ข /api/upload    โ”‚โ—„โ”€โ”€โ–บโ”‚ โ€ข GPT Models    โ”‚
โ”‚ โ€ข Document Data โ”‚    โ”‚ โ€ข /api/chat/streamโ”‚    โ”‚ โ€ข Real-time     โ”‚
โ”‚ โ€ข Chat History  โ”‚    โ”‚ โ€ข No Storage     โ”‚    โ”‚   Processing    โ”‚
โ”‚ โ€ข Session State โ”‚    โ”‚ โ€ข Stateless      โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Chunked Upload System

When uploading large document sets:

  1. Size Detection: Frontend calculates total upload size
  2. Automatic Chunking: Splits into 3.5MB chunks if needed
  3. Parallel Processing: Each chunk processed independently
  4. Progressive Results: Documents become available as chunks complete
  5. Error Recovery: Failed chunks can be retried individually

๐Ÿ”ง API Endpoints

POST /api/upload

Upload and process PDF documents

  • Input: FormData with files and description
  • Output: Processed documents with extracted text
  • Features: Automatic chunking, progress tracking

POST /api/chat/stream

Stream chat responses in real-time

  • Input: Question, documents, chat history
  • Output: Server-sent events with processing steps
  • Features: Real-time progress, cost tracking, citations

GET /api/health

Service health check

  • Output: System status and mode information

๐ŸŽฏ Advantages Over Traditional RAG

Traditional RAG Vectorless Approach
๐Ÿ—„๏ธ Requires vector database ๐Ÿšซ No database needed
๐Ÿ“Š Pre-processes to embeddings ๐Ÿ”„ Real-time processing
๐Ÿ’ฐ Expensive infrastructure ๐Ÿ’ธ Serverless & cost-effective
๐Ÿ”’ Stores data on servers ๐Ÿ›ก๏ธ Browser-only storage
๐Ÿ“ Limited by embedding dimensions ๐Ÿง  Full context understanding
โšก Fast retrieval, lossy context ๐ŸŽฏ Accurate reasoning, full context

๐ŸŒŸ Example Workflow

  1. Upload: Marketing team uploads 50 company PDFs
  2. Describe: "Company policies, procedures, and guidelines"
  3. Ask: "What is our remote work policy?"
  4. Process:
    • ๐Ÿง  LLM selects "HR Handbook" and "Remote Work Guidelines"
    • ๐ŸŽฏ Identifies relevant pages about remote work
    • ๐Ÿ’ฌ Generates comprehensive answer with citations
  5. Result: Accurate answer in ~15 seconds with cost breakdown

๐Ÿ”ฎ Future Enhancements

  • Multi-format Support: Word docs, PowerPoint, Excel
  • Advanced Citations: Highlight exact text passages
  • Collaboration Features: Share sessions with team members
  • Analytics Dashboard: Usage patterns and insights
  • Custom Models: Support for local and custom LLMs
  • Batch Operations: Process multiple questions simultaneously

๐Ÿค Contributing

We welcome contributions! This project showcases how modern LLMs can replace traditional vector-based approaches while providing better accuracy and user experience.

๐Ÿ“„ License

MIT License - see LICENSE file for details.


โญ Star us on GitHub if you find this vectorless approach interesting!

Built with โค๏ธ by ROE AI Inc.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •