Skip to content

AI-powered personal knowledge base with RAG and multi-agent validation for natural language search across PDFs, notes, and research papers.

Notifications You must be signed in to change notification settings

sauravbaid3/second-brain-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Personal Knowledge Base (Second Brain)

An end-to-end RAG-based personal knowledge base. Upload PDFs, notes, bookmarks, and research papers. Chat naturally to query your documents. A critic agent validates responses for factual consistency.

Features

  • Upload and manage documents (PDF, text, markdown, HTML)
  • Ingestion: parse, chunk, and embed content
  • Vector search + RAG generation
  • Critic agent that checks answers against sources
  • Minimal web UI (uploads + chat)
  • Dockerized deployment

Quickstart (Local)

  1. Copy .env.example to .env and update keys
  2. Install Docker and Docker Compose
  3. Run:
docker compose up --build
  1. Open the UI at http://localhost:5173
  2. API docs at http://localhost:8000/docs

Development (no Docker)

  • Backend (Python 3.11+):
python -m venv .venv
. .venv/Scripts/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r backend/requirements.txt
uvicorn app.main:app --app-dir backend --reload --host 0.0.0.0 --port 8000
  • Frontend:
cd frontend
npm i
npm run dev -- --host

Configuration

Set environment variables in .env:

  • OPENAI_API_BASE, OPENAI_API_KEY: OpenAI-compatible API
  • OPENAI_MODEL, OPENAI_EMBED_MODEL: chat and embedding models
  • DATA_DIR, VECTOR_DB_DIR, UPLOAD_DIR: storage paths
  • CORS_ALLOW_ORIGINS: comma-separated or *

Stack

  • Backend: FastAPI, LangChain, FAISS
  • LLM: OpenAI-compatible API
  • Frontend: React + TypeScript

Deployment

  • docker-compose.yml runs backend and frontend services
  • Bind mounts storage/ for persistence

Notes

  • For air-gapped or self-hosted LLMs, set OPENAI_API_BASE to your server
  • PDFs parsed with pypdf; HTML/Markdown with BeautifulSoup and markdown-it-py

About

AI-powered personal knowledge base with RAG and multi-agent validation for natural language search across PDFs, notes, and research papers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published