Skip to content

Latest commit

 

History

History
172 lines (131 loc) · 5.29 KB

File metadata and controls

172 lines (131 loc) · 5.29 KB

DocuRAG — Document Retrieval & Augmented Generation

Ask anything about your documents in plain English. Upload PDF, DOCX, Excel, CSV, PPT, or images — get answers with page-level citations.

CI Live Demo Python License


✨ Features

  • 🔐 Google OAuth — secure login with your Google account
  • 💬 Multiple chat sessions — each chat has its own isolated document context
  • 📄 10+ file formats — PDF · DOCX · XLSX · XLS · CSV · PPTX · TXT · MD · PNG · JPG
  • 🔍 Page-level citations — every answer cites exact source and page number
  • 🤖 Smart fallback — if answer isn't in documents, uses general knowledge (clearly labeled)
  • 🔄 Multi-document comparison — upload JD + Resume, ask "does my resume match?"
  • 📊 User activity logging — every login, query, and upload tracked per user
  • 🗂️ Chat history — persisted across sessions, auto-deleted after 7 days
  • 🎨 Light + dark theme — adapts to system preference

🏗️ Architecture

app.py                         # Streamlit UI (thin shell)
│
└── src/
    └── rag_docqa/
        ├── pipeline.py        # Orchestrates the complete RAG pipeline (per session)
        ├── ingestor.py        # Parses PDF, DOCX, XLSX, CSV, PPTX, TXT, MD, and images
        ├── vectorstore.py     # ChromaDB vector store (session-isolated collections)
        ├── llm.py             # Groq / Llama 3.3 70B inference with fallback support
        ├── sessions.py        # SQLite-based chat session management
        ├── auth.py            # Google OAuth authentication (Streamlit OIDC)
        ├── logger.py          # User activity and audit logging
        └── config.py          # Application configuration (Pydantic Settings)

Tech stack:

Layer Technology
LLM Groq · LLaMA 3.3 70B Versatile
Embeddings HuggingFace all-MiniLM-L6-v2 (free, local)
Vector DB ChromaDB (per-session isolation)
UI Streamlit
Auth Google OAuth (Streamlit native OIDC)
Sessions SQLite
Package manager uv

🚀 Quick Start

Prerequisites

Install

git clone https://github.com/codewithleo1/docurag-intelligence
cd docurag-intelligence
uv sync

Configure

copy .env.example .env

Fill in .env:

GROQ_API_KEY=gsk_your_key_here

Create .streamlit/secrets.toml:

[auth]
redirect_uri = "http://localhost:8501/oauth2callback"
cookie_secret = "your_random_secret"

[auth.google]
client_id = "your_client_id"
client_secret = "your_client_secret"
server_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"

Run

uv run streamlit run app.py

🧪 Development

# Run tests
python -m pytest

# Lint
uv run ruff check --fix src/rag_docqa app.py

# Format
uv run ruff format

🌐 Deploy (Streamlit Cloud — Free)

  1. Fork this repo
  2. Go to share.streamlit.io
  3. Connect repo, entry point: app.py, Python: 3.12
  4. Add secrets in Advanced Settings
  5. Deploy → get live URL

📁 Project Structure

docurag-intelligence/
├── app.py                      # Streamlit application entry point
├── pyproject.toml              # Project dependencies and uv configuration
├── .env.example                # Environment variables template
├── .streamlit/
│   └── config.toml             # Streamlit configuration and theme
├── src/
│   └── rag_docqa/
│       ├── auth.py             # Google OAuth authentication
│       ├── config.py           # Application settings (Pydantic)
│       ├── ingestor.py         # Document parsing and chunking
│       ├── llm.py              # Groq Llama 3.3 interface and fallback logic
│       ├── logger.py           # User activity logging
│       ├── pipeline.py         # RAG orchestration pipeline
│       ├── sessions.py         # SQLite chat session management
│       └── vectorstore.py      # ChromaDB vector store management
├── tests/
│   └── test_ingestor.py        # Unit tests for document ingestion
└── .github/
    └── workflows/
        └── ci.yml              # GitHub Actions CI workflow

🔒 Security

  • No secrets committed to git
  • Google OAuth for authentication
  • Per-user, per-session document isolation
  • Activity logs stored locally only
  • ChromaDB collections auto-scoped per session

📄 License

MIT — feel free to fork and build on this.


Built with ❤️ using Groq, LLaMA 3.3, ChromaDB, and Streamlit