Skip to content

borhanst/pdf_chat

Repository files navigation

Chat PDF Application

A Django application that allows users to chat with PDF documents using vector embeddings and PostgreSQL with pgvector.

Prerequisites

  • Docker
  • Docker Compose

Tech Stack

  • Python 3.12
  • Django
  • PostgreSQL with pgvector
  • ChromaDB
  • UV package manager (instead of pip)
  • pgAdmin

Getting Started

Clone the repository

git clone <repository-url>
cd chat-pdf

Running with Docker Compose

  1. Build and start the containers:
docker compose up --build

This will start the following services:

Running Locally (Without Docker)

  1. Set up a Python virtual environment (Python 3.12 recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install UV package manager here:

  2. Install dependencies:

uv sync
  1. Install and configure PostgreSQL:
  • Install PostgreSQL 15 or later
  • Enable pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector;
  • Create a database named 'pdf_chat'
  1. 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
  1. Run migrations:
uv run manage.py migrate
  1. Start the development server:
uv run manage.py runserver

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

Note

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published