symfonic.memory.backends.postgres_vector¶
postgres_vector ¶
PostgreSQL vector backend using pgvector.
Implements VectorBackend protocol with cosine distance (<=> operator).
All operations enforce tenant isolation via WHERE tenant_id = $N.
asyncpg and pgvector must be installed.
pip install symfonic-core[postgres]
PostgresVectorBackend ¶
VectorBackend backed by PostgreSQL + pgvector.
Uses cosine distance (<=> operator) for similarity search.
All operations enforce tenant isolation via WHERE tenant_id = $N.
Source code in src/symfonic/memory/backends/postgres_vector.py
count
async
¶
Return the total number of stored vectors for the tenant.
Source code in src/symfonic/memory/backends/postgres_vector.py
ensure_schema
async
¶
Create the memory_vectors table and indexes if not present.