symfony/ai-postgres-store
PostgreSQL pgvector vector store integration for Symfony AI Store, with support for vector and halfvec types, distance operators, indexes, and full-text search.
Architecture Fit
symfony/ai-postgres-store is a bridge, not a platform: it implements Symfony AI's StoreInterface against PostgreSQL + pgvector. In a Laravel codebase it slots in as an infrastructure adapter behind a domain-level VectorStore contract, not as something controllers or jobs call directly.VectorDocumentInterface (v0.14.0) is the most consequential API surface for us: it gives a stable contract to map Eloquent models or DTOs into stored documents. That determines whether vector data stays aligned with our domain model or degrades into opaque array payloads.count() support (v0.14.0) and clear() (v0.11.0) are the features that make this operable rather than demo-ware — pagination, "N results found" UX, index-size dashboards, and reindex workflows all depend on them.Integration Feasibility
CREATE EXTENSION vector.vector/halfvec column type. Migrations will need raw SQL or a custom schema grammar macro; query building for distance operators (<->, <#>, <=>) will need raw expressions or a small query builder wrapper.symfony/ai monorepo with issues tracked there. It is credible because of the Symfony org backing, but it is pre-1.0 and interfaces have already moved (VectorDocumentInterface, clear(), count).Technical Risk
composer update.StoreInterface boundary means a swap to another pgvector client or a managed vector DB is a contained change if we do not leak Symfony types upward.COUNT(*) over large vector tables with filters can be expensive. Decide up front whether counts are exact, cached, or approximate; do not let a dashboard query dictate the data model.Key Questions
pgvector extension, and at what version? Who owns that change?VectorDocumentInterface, or keep a dedicated DTO layer? (Recommend DTO — it insulates us from interface churn.)Stack Fit
VectorStoreServiceProvider, expose a VectorStore facade/contract, and keep Symfony AI types confined to app/Infrastructure/VectorStore/.DB::statement: necessary for vector/halfvec columns and distance-operator queries. Do not fight Eloquent here; wrap it once.Migration Path
vector column via raw migration, write one embedding, run one similarity query and one count(). This retires the two biggest unknowns before roadmap commitment.VectorStore interface (upsert, query, count, delete, clear) with VectorDocument DTOs. Implement it with the Symfony bridge. This is the decision that makes the pre-1.0 risk manageable.symfony/ai and symfony/ai-postgres-store pinned to an exact minor; upgrades done deliberately with changelog review against the main symfony/ai repo.Compatibility
VectorDocumentInterface in domain code; adapt to it at the boundary so upstream changes cost one file, not a refactor.Sequencing Feasibility spike → contract + adapter → schema + index → backfill/reindex tooling → internal/admin surface → flagged user-facing search → production hardening. Do not start with user-facing search; the operational tooling (reindex, coverage counts, latency metrics) is what makes it survive contact with production.
Maintenance
symfony/ai monorepo changelog before every bump; releases like VectorDocumentInterface and StoreInterface::clear() are the kind of change that silently breaks custom implementations.Support
symfony/ai repository, under a Symfony org, with a 2-star package's worth of community attention. Do not assume responsive upstream support; assume we can patch or vendor a fork if needed.Scaling
CONCURRENTLY, off-peak, and monitored.Failure Modes
clear()/remove() wired into model events, plus a scheduled reconciliation job.Ramp-Up
EXPLAIN on vector queries) plus familiarity with the Symfony AI store contracts — neither is common Laravel background.How can I help you explore Laravel packages today?