Saltar al contenido principal

pgvector control plane

pgvector is the default BaseVectorStore adapter for the KB layer. PgVectorStore wraps the extracted alphaswarm_kb.rag.pgvector_store.PgVectorStore behind the BaseVectorStore port so the standard KBRuntime can target the existing pgvector control plane without leaking adapter specifics.

Migration

  • alembic/versions/0045_pgvector_phase3.py — pgvector indexes on the three allow-listed tables (rag_chunks, codebase_symbol_embeddings, ml_feature_vectors).
  • alembic/versions/0088_alphaswarm_kb_specs.py — the nine KB tables (kb_corpora, kb_runs, kb_subscriptions, ...).

Agent surface

ToolPurpose
data.vector.searchFree-text or pre-computed embedding ANN over the allow-listed tables.
data.vector.upsert(Step-up gated) write through PgVectorStore.upsert.
data.vector.delete(Step-up gated) targeted delete by id.
data.embeddings.computeCompute an embedding via the central embedder.

Adding a new pgvector-backed table

  1. Add the migration under alembic/versions/ with a Vector(N) column + an HNSW index.
  2. Extend the _ALLOWED_TABLES whitelist in alphaswarm/data/mcp/tools/vector.py.
  3. Add an EntityPicker kind for the table to alphaswarm/cache/keys.py.
  4. Add a BaseDataset kind under alphaswarm/data/datasets/kinds/ if the table is also surfaced through the dataset catalog.