Add a check constraint on the column (Postgres allows CHECK on dimension via a function) AND a Pydantic validator at write time. Two layers: the column refuses bad inserts; the wrapper catches the bug upstream so nobody else has to chase it.
CHECK (vector_dims(embedding) = 1536) on the column.
Embedding model returns an array; Pydantic v2 validates length matches expected dim.
CI test: insert a wrong-dim vector and assert ValueError.
embed(text) -> vector dim N -> Pydantic check dim matches
INSERT -> Postgres CHECK (vector_dims() = N)
Two layers of dim check (Pydantic + Postgres) — one bug caught at app, one at DB.