Files
Investidor-V2/docs/investmoz/ai/vector-proposal.sql
T
nala 250ac35fd1
tests / ci (push) Canceled after 0s
first commit
2026-09-28 10:01:09 +02:00

19 lines
1.0 KiB
SQL

-- Proposed optional phase. NOT applied by the ordinary migration runner.
-- Requires an approved pgvector installation in the SAME InvestMoz database,
-- a benchmarked embedding model and a reviewed backup/rollback plan.
-- BGE-M3 candidate dimension: 1024. Changing the model requires a new embedding
-- version and reindexing, not mixing incomparable vectors.
CREATE TABLE ai_embeddings (
chunk_id uuid NOT NULL REFERENCES ai_chunks(id) ON DELETE RESTRICT,
model_id text NOT NULL,
model_revision text NOT NULL,
content_checksum char(64) NOT NULL,
embedding vector(1024) NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (chunk_id, model_id, model_revision)
);
-- Start with exact filtered search, then benchmark HNSW with real ACL filters.
-- Eligible sources must be filtered using the same rules as EvidenceRepository;
-- matching model/revision/checksum is mandatory BEFORE fusion and reranking.
-- Do not run CREATE EXTENSION against an unverified PostgreSQL installation.