A fully local AI-powered document processing and search system.
Local RAG is a robust Retrieval-Augmented Generation (RAG) application that uses Ollama local models and FAISS for efficient document processing and semantic search capabilities.
👉 Watch the full demo video on YouTube
This application provides an enhanced RAG implementation with the following key features:
- Multi-format document processing: Support for PDF, DOCX, CSV, Excel, XML, and images
- Semantic search with content-type awareness: Intelligent document understanding
- Batch processing for large files: Handle big documents and multiple files efficiently
- Rate limiting and error handling: Reliable API performance
- Automatic backup and recovery: Data integrity protection
- Enhanced query expansion and results reranking: Better search results
- Faceted search capabilities: Filter and navigate search results
- OCR support for images: Extract text from images and PDFs
- Progress tracking and webhook notifications: Monitor long-running tasks
/
├── backend/ # Python FastAPI backend
│ ├── app/ # Main application package
│ │ ├── api/ # API endpoints and models
│ │ ├── core/ # Core settings and logging
│ │ ├── prompts/ # LLM prompt templates
│ │ ├── services/ # Business logic services
│ │ └── utils/ # Utility functions
│ ├── data/ # Data storage directory
│ └── requirements.txt # Python dependencies
│
├── frontend/ # React.js frontend
│ ├── public/ # Public assets
│ ├── src/ # Source code
│ │ ├── components/ # React components
│ │ ├── contexts/ # React contexts
│ │ └── styles/ # CSS and styling
│ └── package.json # JavaScript dependencies
│
├── .gitignore # Git ignore file
└── README.md # This file
- OS: Windows 10/11, macOS, or Linux
- CPU: 4+ cores recommended for faster processing
- RAM: Minimum 8GB, 16GB+ recommended for large documents
- Storage: 10GB+ free space for application and models
- GPU: Required, at least 4GB dedicated GPU RAM for model inference
- Clone the repository
git clone https://github.com/yourusername/localrag.git cd localrag
-
Navigate to the backend directory
cd backend -
Create and activate a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install required packages
pip install -r requirements.txt
-
Start the backend server
python main.py
-
Navigate to the frontend directory
cd frontend -
Install dependencies
npm install
-
Start the frontend development server
npm start
-
Open your browser and navigate to http://localhost:3000
This application requires Ollama for running LLM models locally:
-
Install Ollama from https://ollama.ai/
-
Pull the required models:
ollama pull deepseek-r1:8b
-
Ensure Ollama is running before starting the application
- Upload Documents: Use the file upload in the sidebar to add documents
- Preview Content: Click on files to preview their content
- Ask Questions: Use the chat interface to ask questions about your documents
- View Results: Get AI-generated answers with references to source material
- Toggle "Enhanced Search" mode for more powerful search capabilities
- Use natural language to find information across all your documents
- View faceted search results with filters and highlights
- Get semantically relevant results even with different terminology
- Toggle "Batch Mode" when uploading large or multiple files
- Monitor progress through the batch processing interface
- Receive notifications when batch processing completes
- Access processed documents directly from the interface
Key backend settings can be adjusted in backend/app/core/config.py:
OLLAMA_API_URL: URL for the Ollama APITEXT_EMBEDDING_MODEL: Model for text embeddingsCHUNK_SIZE: Size of text chunks for processingRATE_LIMIT_MAX_REQUESTS: Rate limiting settings
Frontend settings can be adjusted through the settings interface or directly in frontend/src/App.js:
- Ollama API endpoint
- Model parameters
- UI preferences
- Search behavior
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Ollama for providing local LLM capabilities
- FastAPI for the backend framework
- React for the frontend framework
- FAISS for efficient similarity search
- Sentence Transformers for text embeddings
