A Django application that allows users to chat with PDF documents using vector embeddings and PostgreSQL with pgvector.
- Docker
- Docker Compose
- Python 3.12
- Django
- PostgreSQL with pgvector
- ChromaDB
- UV package manager (instead of pip)
- pgAdmin
git clone <repository-url>
cd chat-pdf- Build and start the containers:
docker compose up --buildThis will start the following services:
- Django application (http://localhost:8000)
- PostgreSQL with pgvector
- pgAdmin (http://localhost:5050)
- ChromaDB (http://localhost:8080)
- Set up a Python virtual environment (Python 3.12 recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate-
Install UV package manager here:
-
Install dependencies:
uv sync- Install and configure PostgreSQL:
- Install PostgreSQL 15 or later
- Enable pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector;- Create a database named 'pdf_chat'
- Set up environment variables in a .env file:
POSTGRES_DB=your_database_name
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432- Run migrations:
uv run manage.py migrate- Start the development server:
uv run manage.py runserverThe application will be available at http://localhost:8000
When running locally, make sure you have:
- PostgreSQL 15+ installed with pgvector extension
- Python 3.12+ installed
- System dependencies for pdf processing (python-magic requirements)
- On Ubuntu/Debian:
sudo apt-get install libmagic1 - On MacOS:
brew install libmagic - On Windows: No additional steps needed
- On Ubuntu/Debian: