Skip to content

C1: pgvector adapter implementing BaseClient/BaseCollection + parity tests #12556

Open

Description

@mrveiss

Part of #12551 (Gap C).

Implement the pgvector backend named in knowledge/backends/base.py:8-11.

Scope

  • New knowledge/backends/pgvector_adapter.py: PgVectorClient(BaseClient) + PgVectorCollection(BaseCollection) mirroring chromadb_adapter.py (246 lines) and honouring the exact return-shape contract (base.py:19-27): get→flat-list dict, query→nested-list dict.
  • Reuse the Postgres connection seam from services/memory/postgres_provider.py.
  • Parity tests: run the adapter against the same shared backend test-suite ChromaDB passes.

Acceptance

  • Adapter passes the shared parity suite (add/upsert/update/get/query/delete/count/peek + collection lifecycle).
  • Return shapes match ChromaDB 1.x exactly.
  • No wiring into production selection yet (that's C2).

Activity

  1. mrveiss commented on Jul 26, 2026

    @mrveiss
    OwnerAuthor

    Deferred (owner call, 2026-07-26): prioritised the higher-gain B-lane; pgvector rated low-value in the epic's Phase-2 audit (Chroma/Milvus already cover the vector-store need). Kept as a specced issue.

    Architecture decision recorded for pickup: implement against the async ABCs (AsyncBaseClient/AsyncBaseCollection in knowledge/backends/async_base.py) using asyncpg — which is already a declared dependency — NOT the sync BaseClient (which would add psycopg2, an undeclared dep, and violate the async-first rule). Add a skippable _pgvector_client fixture to knowledge/backends/test_async_base.py's _BACKENDS (importorskip + skip when no Postgres+pgvector reachable) so the existing async parity suite validates it. Per-collection tables (dim inferred on first add) keep each collection's vector(N) index independent. C2 (#12557) then wires it via AUTOBOT_VECTOR_BACKEND=pgvector (default chromadb) + a CREATE EXTENSION IF NOT EXISTS vector idempotent migration.

  2. mrveiss commented on Jul 26, 2026

    @mrveiss
    OwnerAuthor

    Validation blocker (2026-07-26): completing C1 responsibly requires a Postgres+pgvector instance to run the async parity suite against — this session's environment has a Postgres server that rejects connections (no pg_hba entry / creds not available) and no Docker. Rather than ship ~250 lines of never-executed asyncpg SQL (low-value per the epic audit + unvalidatable here = speculative), C1 stays deferred with the async/asyncpg design recorded above. Pickup prerequisite: a PG-with-pgvector test env (CI service container or local instance) so the test_async_base.py parity fixture actually exercises the SQL path.

  3. modified the milestones: Backlog, v0.13.0 on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions