Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PdfSearchAI

PdfSearchAI is a local RAG (Retrieval-Augmented Generation) service that indexes a PDF into Qdrant and answers user queries using Ollama.

Requirements

  • Python 3.10+
  • Docker (for Qdrant + Valkey/Redis)
  • Ollama running locally

Project Files

  • indexing-pdf.py: Loads Resume.pdf, splits text into chunks, builds embeddings, and stores vectors in Qdrant collection learning_rag.
  • main.py: Starts the FastAPI application with Uvicorn on 0.0.0.0:8000.
  • server.py: Defines API routes to enqueue chat jobs and check job status/results.
  • queues/worker.py: RQ worker logic (process_query) that performs vector search and calls Ollama chat.
  • clients/rq_client.py: Creates the Redis-backed RQ queue client.
  • docker-compose.yml: Starts Qdrant (6333) and Valkey/Redis (6379).

Setup

  1. Create and activate a virtual environment.
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies.
pip install -r requirements.txt
  1. Start infrastructure services.
docker compose up -d
  1. Pull required Ollama models.
ollama pull nomic-embed-text
ollama pull llama3.2:1b

Index Your PDF

Place your PDF at ./Resume.pdf (or update the path in indexing-pdf.py) and run:

python3 indexing-pdf.py

Run the Application

Start the API server:

python3 main.py

Start the RQ worker (in a separate terminal):

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES && rq worker --with-scheduler

API Endpoints

  • GET / returns health message.
  • POST /chat?query=... enqueues a background job and returns a job_id.
  • GET /job?job_id=... returns processing status or final result.

How It Works

PDF -> chunking -> nomic-embed-text embeddings -> Qdrant (learning_rag)
User query -> queued job (RQ) -> similarity search -> context -> llama3.2:1b -> response

Learn RAG

About

Effortless Search with AI-Powered PDF Retrieval

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages