Skip to content

kevlariii/no-code-rag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š LocalRAG - Local-First RAG Application

A production-quality Retrieval-Augmented Generation (RAG) application that lets you chat with your documents using Hugging Face models. Upload PDFs, text files, and more β€” then ask questions and get AI-powered answers with source citations.

App Screenshot

✨ Features

  • πŸ“„ Document Upload - Drag & drop PDFs, DOCX, TXT, Markdown, and more
  • πŸ” Smart Chunking - Automatically splits documents into searchable chunks
  • 🧠 RAG Pipeline - Retrieves relevant context before generating answers
  • πŸ’¬ Chat Interface - Natural conversation with source citations
  • πŸ”Ž Document Search - Search your knowledge base directly
  • ⚑ Fast & Local - In-memory vector store for quick responses
  • 🎨 Modern UI - Beautiful React interface with Tailwind CSS

πŸ› οΈ Tech Stack

Backend

  • FastAPI - Modern Python web framework
  • LangChain - LLM application framework
  • Hugging Face Inference API - Cloud-based model inference
  • PyPDF2 & python-docx - Document parsing
  • NumPy - Vector similarity search

Frontend

  • React 18 - UI framework
  • Vite - Build tool
  • Tailwind CSS - Styling
  • Zustand - State management
  • Lucide Icons - Beautiful icons

πŸš€ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/yourusername/no-code-rag.git
cd no-code-rag

2. Set Up the Backend

cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start the server
uvicorn main:app --reload --port 8000

The API will be available at http://localhost:8000

3. Set Up the Frontend

cd frontend

# Install dependencies
npm install

# Start the dev server
npm run dev

The app will be available at http://localhost:5173

4. Configure the App

  1. Open http://localhost:5173 in your browser
  2. Click the Settings icon (βš™οΈ)
  3. Enter your Hugging Face API token
  4. Select your preferred models:
    • Generation: mistralai/Mistral-7B-Instruct-v0.3 (recommended)
    • Embeddings: sentence-transformers/all-MiniLM-L6-v2 (recommended)
  5. Click Save Settings

πŸ“– Usage

Uploading Documents

Upload Screenshot

  1. Drag and drop files into the upload zone, or click to browse
  2. Supported formats: PDF, DOCX, TXT, MD, CSV, JSON, and code files
  3. Click "Index All Documents" to embed them into the knowledge base

Chatting with Your Documents

Chat Screenshot

  1. Type your question in the chat input
  2. The AI will search your documents for relevant context
  3. Get answers with source citations showing which documents were used

Searching Documents

Search Screenshot

  1. Use the search bar to find specific content
  2. Results show matching text chunks with relevance scores
  3. Click on results to see the source document

πŸ”§ API Endpoints

Endpoint Method Description
/health GET Health check
/api/documents/upload POST Upload and embed a file
/api/documents POST Upload documents (JSON)
/api/documents DELETE Clear all documents
/api/documents/status GET Get document count
/api/documents/search POST Search documents
/api/rag/query POST RAG query (chat)
/api/embeddings POST Generate embeddings
/api/generate POST Text generation
/api/models GET List recommended models

πŸ“ Project Structure

no-code-rag/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ routes/          # API endpoints
β”‚   β”‚   └── schemas.py       # Pydantic models
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ hf_client.py     # Hugging Face client
β”‚   β”‚   β”œβ”€β”€ vectorstore.py   # In-memory vector store
β”‚   β”‚   β”œβ”€β”€ rag_chain.py     # RAG pipeline
β”‚   β”‚   └── document_parser.py  # PDF/DOCX parsing
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   └── dependencies.py  # Dependency injection
β”‚   β”œβ”€β”€ main.py              # FastAPI app
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ api/             # API client
β”‚   β”‚   β”œβ”€β”€ state/           # Zustand store
β”‚   β”‚   └── types/           # TypeScript types
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.ts
β”œβ”€β”€ screenshots/             # App screenshots
└── README.md

🎯 Recommended Models

Generation Models (Chat)

Model Description
mistralai/Mistral-7B-Instruct-v0.3 Fast, high-quality responses
microsoft/Phi-3-mini-4k-instruct Compact and efficient
HuggingFaceH4/zephyr-7b-beta Great for conversations
google/gemma-2-2b-it Lightweight option

Embedding Models

Model Description
sentence-transformers/all-MiniLM-L6-v2 Fast, good quality
BAAI/bge-small-en-v1.5 High quality embeddings
sentence-transformers/all-mpnet-base-v2 Best quality, slower

⚠️ Limitations

  • In-memory storage: Documents are lost when the server restarts
  • No authentication: Designed for local use
  • Rate limits: Subject to Hugging Face API rate limits

πŸ›£οΈ Roadmap

  • Persistent vector database (ChromaDB/Pinecone)
  • User authentication
  • Multiple chat sessions
  • Document preview
  • Export chat history
  • Docker deployment

πŸ“„ License

MIT License - feel free to use this project for learning and building!

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with ❀️ using FastAPI, React, and Hugging Face

About

[Ongoing] LocalRag: Drag & Drop your documents and question them without writing a single line of code

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors