Add RAG basic implementation

This commit is contained in:
2026-11-09 08:43:30 +03:00
parent 447464c16c
commit 7fa1d774a0
76 changed files with 3030 additions and 124 deletions
+62
View File
@@ -0,0 +1,62 @@
# Estimator: PostgreSQL with pgvector, a one-shot migration job, and the service.
#
# cp .env.example .env # set POSTGRES_PASSWORD, the LLM key(s), EST_API__KEYS
# docker compose up -d --build
#
# Start-up order: db becomes healthy -> `migrate` applies the schema and exits successfully ->
# `app` starts. If migrations fail, the service does not start.
name: estimator
x-app-environment: &app-environment
EST_ENV: ${EST_ENV:-prod}
EST_DATABASE__DSN: postgresql://estimator:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@db:5432/estimator
services:
db:
image: pgvector/pgvector:pg16
restart: unless-stopped
environment:
POSTGRES_DB: estimator
POSTGRES_USER: estimator
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
volumes:
- dbdata:/var/lib/postgresql/data
healthcheck:
# -h 127.0.0.1: the temporary server of the first start listens on the socket only, so a TCP check
# does not report "ready" before the real server is up
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U estimator -d estimator"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
migrate:
build: .
image: estimator:local
command: ["migrate"]
env_file: .env
environment: *app-environment
depends_on:
db:
condition: service_healthy
restart: "no"
app:
image: estimator:local
command: ["serve"]
env_file: .env
environment: *app-environment
depends_on:
migrate:
condition: service_completed_successfully
ports:
- "${APP_PORT:-8000}:8000"
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
volumes:
dbdata: