#!/usr/bin/env bash
# Start a throwaway pgvector Postgres on port 5544 and build the venv.
set -euo pipefail
docker rm -f rag-lab >/dev/null 2>&1 || true
docker run -d --name rag-lab -e POSTGRES_PASSWORD=lab -p 5544:5432 pgvector/pgvector:pg17 >/dev/null
python3 -m venv .venv
./.venv/bin/pip install -q -r requirements.txt
until docker exec rag-lab pg_isready -U postgres >/dev/null 2>&1; do sleep 1; done
echo "ready: try  ./.venv/bin/python retrieval_check.py --strategy fixed --show q1"
