pay-equity-for-eu / README.md
Franskaman110's picture
Fused retrieval from directive and løn
70b1f2f
|
Raw History Blame
2.83 kB
metadata
title: Pay Equity For Eu
emoji: 🐨
colorFrom: purple
colorTo: indigo
sdk: gradio
sdk_version: 6.17.3
python_version: '3.12'
app_file: main.py
pinned: false
license: apache-2.0
short_description: Multilingual AI assistant to guarantee fair pay

Pay Equity for EU

Multilingual Gradio Space for Danish users: expected pay (IDA lønstatistik) and pay-transparency rights (EU Directive 2023/970), grounded with citations.

Quick start

uv sync
uv run python main.py

Requires a built vector index at data/processed/index/ (see below). Backend details: src/backend/README.md.

Build the vector index

Embed the corpus once (directive articles + IDA salary rows), then commit the output:

uv run python scripts/build_index.py   # GPU / ZeroGPU Space admin button

Produces data/processed/index/index.faiss + chunks.jsonl.

Refresh metadata only (no re-embed)

After changing Chunk.metadata mapping in src/backend/indexing/ingest.py:

uv run python scripts/refresh_metadata.py

Rewrites chunks.jsonl only; vectors stay unchanged. Re-embed if chunk ids or order changed.

Run the RAG benchmark

Offline evaluation of retrieval (and lightweight generation checks) against 15 ground-truth questions in scripts/eval/benchmark_questions.json.

Prerequisites: committed chunks.jsonl plus a local index.faiss. If index.faiss is missing or a Git LFS pointer, rebuild it from the committed chunks (CPU-only, ~few minutes):

uv run python scripts/eval/build_local_index.py

Run the benchmark:

# Full run: retrieval metrics + generation fact/citation checks (default k=5)
uv run python scripts/eval/run_benchmark.py

# Retrieval only (faster)
uv run python scripts/eval/run_benchmark.py --no-generation

# Custom top-k
uv run python scripts/eval/run_benchmark.py --k 10

Output: human-readable summary on stdout + JSON report at scripts/eval/results/benchmark_YYYYMMDD_HHMMSS.json.

Metrics: Recall@k, MRR, NDCG@k (retrieval); fact coverage and citation presence (generation). See scripts/eval/BENCHMARK_FINDINGS.md for the latest scored run and failure analysis.

Note: The benchmark script uses a single global FAISS top-k search, not the production per-source + RRF fusion in rag.py. Use it to track embedding quality; for end-to-end production behaviour, test via the Gradio UI or /chat API.

Data

Path Contents
data/processed/directive/ Parsed EU Directive 2023/970
data/processed/lonstatistik/ IDA + Djøf salary statistics (README)
data/processed/index/ FAISS index + aligned chunks.jsonl

Raw PDFs live under data/raw/ (gitignored).