- What is symfony/ai-postgres-store and what does it do?
- It is a PostgreSQL bridge for Symfony AI Store that uses the pgvector extension as the backing vector store. It lets your application persist embeddings and run similarity queries, so you can build semantic search, recommendations, and hybrid search features on infrastructure you likely already run. The package is part of the wider Symfony AI monorepo and follows its Store contracts.
- How do I install symfony/ai-postgres-store in a Laravel application?
- Install it with Composer alongside the Symfony AI store packages, then bind the PostgreSQL store through a Laravel service provider or facade. Because the package is Symfony-oriented, most Laravel teams wrap it in a small adapter or resolve it from the container rather than using it directly in controllers. You will also need a PostgreSQL connection configured with the pgvector extension available.
- Does this package support Laravel 10 and 11, or is it Symfony only?
- The package targets Symfony AI rather than shipping Laravel-specific integrations, but it can be used in Laravel 10 and 11 through the service container or Doctrine DBAL. There is no first-party Eloquent driver, so expect to write a thin adapter layer. Pin your Symfony AI dependency versions and test the binding after each upgrade.
- Do I need the pgvector extension installed in PostgreSQL?
- Yes. The store relies on pgvector for vector and halfvec column types, distance operators, and index types such as HNSW and IVFFlat. You or your DBA must provision the extension on every environment, including CI and staging, before migrations run. Managed PostgreSQL providers often support pgvector but may require it to be enabled explicitly.
- What does the count capability added in v0.14.0 enable?
- Count support lets you retrieve the number of stored vectors without writing custom SQL, which is useful for pagination, dashboard metrics, capacity planning, and usage or billing reporting. It improves the operational fit of the store for admin tooling and sync jobs. Keep in mind that exact counts on very large vector tables can be costly, so cache or approximate where real-time accuracy is not required.
- What is VectorDocumentInterface and should I map Eloquent models to it?
- VectorDocumentInterface is a stable contract introduced in v0.14.0 that describes a document stored in the vector store, letting you decouple your domain objects from concrete Symfony classes. You can either map Eloquent models directly to it or keep a separate DTO layer that implements the interface. A dedicated DTO layer usually makes upgrades and testing easier, while direct mapping reduces boilerplate.
- Can I combine vector similarity search with PostgreSQL full-text search?
- Yes. pgvector handles vector similarity while PostgreSQL's built-in full-text search can handle keyword matching, and the two can be combined for hybrid ranking. This is a key differentiator for search use cases that need both semantic recall and exact term matching. You will typically implement the fusion logic yourself, for example with reciprocal rank fusion in SQL or in your application layer.
- How do I add a vector column to a Laravel migration?
- Eloquent has no native vector column type, so use Laravel's schema builder with a raw SQL statement or a DB::statement call to add a vector or halfvec column. You also need to create an appropriate index, such as HNSW, and ensure the pgvector extension is enabled in the same migration or beforehand. Keep these migrations explicit so schema changes from pgvector updates stay predictable.
- Are exact count queries expensive on large vector tables?
- They can be. Exact counts may trigger full scans on large tables, so define an acceptable latency target based on your expected vector volume before relying on them in request paths. Common mitigations include indexing, cached counts, approximate counts, or maintaining a separate metadata table for reporting. Reserve real-time exact counts for cases where accuracy genuinely matters.
- Is it safe to use in production given the 0.x version, and what should I check before upgrading?
- The package is still on a 0.x line, so the Symfony AI Store interface and document contracts may keep evolving between minor releases. Pin your Composer dependencies, review the changelog for interface changes such as VectorDocumentInterface, and test any custom store or document implementations before upgrading. If pgvector exact counts or index performance stop meeting your needs at scale, partitioning, sharding, or a managed vector service are the usual alternatives.