packages/rag/
embed-policy-text.ts # Gemini embedding wrapper
vector-sql.ts # converts number[] to pgvector string
embed-policy-chunks.ts # backfills missing embeddings
smoke-test-vector-search.ts # manual similarity search test
package.json # add embed + smoke scripts
index.ts # export embedding helpers if useful
package.json # add rag:embed-policies
packages/db/prisma/schema.prisma
# likely no change needed if embedding Unsupported("vector(768)") already exists
packages/db/prisma/migrations/.../migration.sql
# confirm CREATE EXTENSION IF NOT EXISTS vector exists

Proof
Generate embeddings for Policy Chunks are store it to PgVector
bun run rag:embed-policies


Smoke Test
PgVector uses nearest neighbour search to find chunk embeddings that is closest to User’s query.
bun --filter @repo/rag smoke:vector-search "Is theft claim ready for approval if FIR number is missing?"
