Skip to content

feat(adk): add vector memory support for psqlpy and PostgreSQL ADBC #728

Description

@cofin

Summary

The psqlpy and ADBC ADK memory stores accept StoredMemory.embedding and an embedding search argument through the shared public contract, but currently ignore both.

  • PsqlpyADKMemoryStore creates no vector column, omits embeddings from inserts, and performs text-only searches.
  • AdbcADKMemoryStore is multi-dialect and reduced-scope; its PostgreSQL path likewise has no vector column or search branch and returns embedding=None.

This makes PostgreSQL vector-memory behavior inconsistent across SQLSpec adapters and silently discards caller data.

Proposed behavior

Add PostgreSQL ADK vector-memory support for psqlpy and the PostgreSQL ADBC backend while preserving reduced-scope behavior for non-PostgreSQL ADBC drivers.

  • Persist nullable embeddings in owner and non-owner insert paths.
  • Add vector-only nearest-neighbor search with null embeddings excluded.
  • Use codec-independent parameter binding. Psqlpy supports explicit SQL casts; determine and document the portable ADBC PostgreSQL binding representation rather than assuming native pgvector codecs.
  • Return stored embeddings when the backend exposes them.
  • Do not silently ignore a supplied embedding on an unsupported ADBC backend; fail clearly or expose an explicit capability boundary.
  • Decide whether pg_textsearch BM25/hybrid search should reach parity in the same implementation or remain a separately declared capability.

Acceptance criteria

  • Unit tests cover SQL, nullable embeddings, owner-column parameter ordering, and vector query operands for both adapters.
  • PostgreSQL integrations insert via the public memory-store API and assert nearest-neighbor IDs/order with client pgvector codecs disabled.
  • ADBC tests cover PostgreSQL vector decoding and unsupported non-PostgreSQL behavior.
  • Adapter documentation and the ADK backend matrix accurately describe vector and BM25 capabilities.
  • No public method signatures or shared record types change.

Related: #726, #727

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions