A powerful Retrieval-Augmented Generation (RAG) system that enables intelligent document querying with multiple AI backends. Upload documents, ask questions, and get comprehensive answers powered by state-of-the-art language models.
- π Multi-format Document Support: PDF processing and text extraction
- π€ Multiple AI Backends:
- LexRank: Extractive summarization for quick insights
- DistilBART: Abstractive summarization for coherent responses
- Ollama (LLaMA3): Large language model for comprehensive analysis
- π Vector Search: FAISS-powered semantic search with sentence transformers
- π Web Interface: Clean Streamlit UI with real-time backend switching
- π REST API: FastAPI backend with comprehensive documentation
- π³ Docker Support: Containerized deployment with docker-compose
- βοΈ Cloud Access: Cloudflare tunnel integration for public deployment
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Streamlit UI βββββΆβ FastAPI Backend βββββΆβ AI Backends β
β (Port 8501) β β (Port 8000) β β - LexRank β
βββββββββββββββββββ ββββββββββββββββββββ β - DistilBART β
β β - Ollama β
βΌ βββββββββββββββββββ
ββββββββββββββββββββ
β FAISS Vector DB β
β + Document Store β
ββββββββββββββββββββ
π Main Application: https://deepresearcher.page
π API Documentation: https://api.deepresearcher.page/docs
- Python 3.10+
- Ollama (for LLM backend)
- Docker & Docker Compose (optional)
- Cloudflare Account (for public deployment)
-
Clone the repository
git clone <your-repo-url> cd deep-researcher
-
Create virtual environment
python3 -m venv venv310 source venv310/bin/activate # On Windows: venv310\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Download NLTK data
python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab')" -
Install and start Ollama
# Install Ollama from https://ollama.ai/ ollama serve & ollama pull llama3
-
Start with Docker Compose
docker-compose up -d --build
-
Ensure Ollama is running on host
ollama serve & ollama pull llama3
Local Development:
# Terminal 1: Start FastAPI backend
source venv310/bin/activate
cd app
python main.py
# Terminal 2: Start Streamlit UI
source venv310/bin/activate
cd app
streamlit run streamlit_app.py --server.port 8501
# Terminal 3: Start Ollama (if not running)
ollama serveDocker:
docker-compose up -d- Upload Documents: Drag and drop PDF files into the upload area
- Select AI Backend: Choose between LexRank, DistilBART, or Ollama
- Ask Questions: Type your questions about the uploaded documents
- Get Answers: Receive contextual responses based on document content
POST /upload- Upload and process documentsPOST /query- Query documents with specific backendGET /backend- Get current active backendPOST /set_backend- Switch between AI backendsGET /docs- Interactive API documentation
# Backend Configuration
SUMMARIZER_BACKEND=ollama # Default backend: lexrank, distilbart, ollama
OLLAMA_MODEL=llama3 # Ollama model to use
OLLAMA_HOST=localhost:11434 # Ollama server address
# Docker Configuration
OLLAMA_HOST=host.docker.internal:11434 # For Docker deploymentsFor public deployment with custom domain:
-
Install cloudflared
# macOS brew install cloudflare/cloudflare/cloudflared # Other platforms: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/
-
Authenticate with Cloudflare
cloudflared tunnel login
-
Create tunnel
cloudflared tunnel create deepresearcher
-
Configure DNS routes
cloudflared tunnel route dns deepresearcher deepresearcher.yourdomain.com cloudflared tunnel route dns deepresearcher api.deepresearcher.yourdomain.com
-
Install as system service
sudo cloudflared service install
deep-researcher/
βββ app/
β βββ main.py # FastAPI backend server
β βββ streamlit_app.py # Streamlit web interface
β βββ retreiver.py # Document retrieval and vector search
β βββ summarizer.py # AI backend implementations
β βββ ingest_and_index.py # Document processing utilities
β βββ sample_docs/ # Example documents
β βββ uploaded_docs/ # User uploaded documents
βββ venv310/ # Python virtual environment
βββ .cloudflared/ # Cloudflare tunnel configuration
βββ docker-compose.yml # Docker deployment configuration
βββ Dockerfile # Container build instructions
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Type: Extractive summarization
- Use Case: Quick document insights, key sentence extraction
- Pros: Fast, preserves original text
- Cons: Limited creativity, may miss context
- Type: Abstractive summarization
- Use Case: Coherent summaries, text generation
- Pros: Natural language generation, contextual understanding
- Cons: Moderate resource usage
- Type: Large Language Model
- Use Case: Complex reasoning, detailed analysis
- Pros: Comprehensive responses, advanced reasoning
- Cons: Requires more computational resources
- Embedding Model:
all-MiniLM-L6-v2(384 dimensions) - Vector Database: FAISS with flat index
- Similarity: Cosine similarity for document retrieval
- Chunk Size: Optimized for document context
- Supported Formats: PDF (via PyPDF2)
- Text Extraction: Automatic preprocessing and cleaning
- Storage: Local file system with metadata tracking
Perfect for testing and development with full control over all components.
Simplified deployment with consistent environment across platforms.
Public access via Cloudflare tunnels with custom domain support.
- Document uploads are stored locally
- No data persistence beyond session for uploaded content
- API endpoints are rate-limited
- Cloudflare provides DDoS protection and SSL termination
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add 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.
- Streamlit for the amazing web framework
- FastAPI for the robust API framework
- Ollama for local LLM serving
- FAISS for efficient vector search
- Sentence Transformers for text embeddings
- Cloudflare for tunnel infrastructure
For questions, issues, or feature requests, please open an issue in the GitHub repository.
π¬ Happy Researching! π¬