symfony/ai-store
Symfony AI Store provides a low-level abstraction for storing and retrieving documents in vector stores, with bridge packages for popular backends. Experimental and not covered by Symfony’s BC promise.
StoreInterface implementations (e.g., PostgresStore).PreQueryEvent/PostQueryEvent can be extended via Laravel’s listeners for logging, caching, or analytics.IndexerInterface) can leverage Laravel Queues for async processing; v0.14.0’s indexer options passthrough allows queue jobs to vary loader behaviour (batch size, filters) per dispatch.config('features.ai_store')) and version pinning (^0.14.0) in composer.json.HybridQuery (keyword + vector) complements Laravel’s Eloquent query builder, enabling unified search UIs.VectorDocumentInterface: Documents are now type-hinted against an interface rather than a concrete class. This is the single most TPM-relevant change: it opens the door to domain objects implementing the interface directly (e.g., an Eloquent model or a DTO), reducing the manual mapping layer previously required, and it makes test doubles trivial.count() on stores: Enables pagination and result-count UIs without materialising vectors. Previously this required a separate search() with a large limit or a backend-specific query, so it removes an entire class of bespoke code from the search controller.VectorInterface in vector queries: Decouples query construction from the concrete Vector class, so custom vector sources (e.g., cached embeddings, multi-modal vectors) can be passed directly. Low integration effort, moderate architectural upside.composer require symfony/ai-store:^0.14 symfony/ai-postgres-store).AppServiceProvider:
$this->app->bind(StoreInterface::class, PostgresStore::class);
pgvector (requires extension). Note count() support is bridge-dependent—verify the Postgres bridge exposes it before relying on it for pagination.RESEMBLANCE for cosine similarity).sqlite-vec support (zero-config for local dev).pgvector extension in PostgreSQL).VectorDocumentInterface makes an HasVectorDocument-style trait straightforward to write in-house, but the package does not ship one.^0.14.0 (minor-range) and gate all store calls behind feature flags.count() is an interface addition. Any in-house StoreInterface implementation or decorator (caching store, logging store, tenancy wrapper) must add a count() method or it will fatal. Audit custom stores before bumping.VectorDocumentInterface type hints widen parameters (generally BC-safe) but may narrow return types in some signatures. Any code doing instanceof VectorDocument or type-hinting the concrete class should be reviewed.load() may need signature updates.count() across bridges is not guaranteed at release.TextSplitTransformer still requires tuning chunk_size/delay; v0.14.0 lets these be passed per-indexing run rather than baked into the loader constructor—a genuine win for multi-tenant or per-collection tuning.Indexer::index(), but memory limits may require chunked processing.VectorDocumentInterface enables a clean mapping trait, but it is still our code to write and maintain.count() in v0.14.0, and if not, what is our fallback for pagination?StoreInterface implementations or decorators that need a count() method before upgrade?ai-redis-store)?HasVectorDocument trait now that VectorDocumentInterface exists, or defer until the API stabilises?StoreInterface implementations via bindings (e.g., PostgresStore for production, InMemoryStore for testing).PreQueryEvent/PostQueryEvent with Laravel listeners for analytics or caching.Indexer::index()) to Laravel Queues, passing loader/indexer options per job for per-collection tuning.pgvector extension; create a custom PostgresStore config:
'ai_store' => [
'postgres' => [
'connection' => 'pgsql',
'table' => 'vector_documents',
'vector_column' => 'embedding',
],
],
ai-redis-store with Redis modules (e.g., RESEMBLANCE for cosine distance).ai-sqlite-store).symfony/ai-platform for vectorization (e.g., OpenAIVectorizer):
$vectorizer = new OpenAIVectorizer($client, 'text-embedding-ada-002');
$indexer = new Indexer($vectorizer, new PostgresStore($connection));
VectorDocumentInterface on an internal DTO (or Eloquent accessor-backed wrapper) so documents flow through stores without an adapter class.InMemoryStore for local testing.PostgresStore/RedisStore for validation.^0.14.0 on a branch; run the full test suite.count() to any custom store/decorator; verify loader load() signatures.instanceof VectorDocument checks with VectorDocumentInterface hints.StoreInterface calls in Laravel’s feature() helper.pgvector extension (PostgreSQL) or Redis modules via Docker.PreQueryEvent to log query performance; log count() latency separately if used on hot pagination paths.ai-store alongside existing vector logic (e.g., direct Pinecone SDK).config('features.ai_search')).| Laravel Component | Integration Notes | Workarounds |
|---|---|---|
| Eloquent | No first-party trait; VectorDocumentInterface (v0.14.0) makes a custom trait viable |
Implement interface on a DTO or via Accessors/Mutators |
| Scout | No native integration | Build custom ScoutEngine adapter |
| Cache | PSR-6 bridge exists (ai-cache-store) |
Wrap in Laravel Cache facade |
| Queues | Supports async Indexer::index(); per-run loader options in v0.14.0 |
Use Laravel Queues for batch processing |
| Events | Extend PreQueryEvent/PostQueryEvent |
Register listeners in EventServiceProvider |
| Pagination | count() added in v0.14.0; bridge coverage varies |
Fallback to search() with bounded limit |
^0.14.0 on a branch, run tests, patch custom stores/loaders, audit VectorDocument type hints.StoreInterface to a bridge (e.g., PostgresStore).Indexer for document ingestion; introduce a VectorDocumentInterface implementation as the canonical document type.HybridQuery support for keyword + vector search.count() into paginated search endpoints (with fallback path).ai-redis-store.TextSplitTransformer) using per-run indexer options.PreQueryEvent/PostQueryEvent via Laravel’s Log facade.symfony/ai-store to minor versions (^0.14.0) due to experimental status.StoreInterface (count) and introduced VectorDocumentInterface. Expect further additive interface changes at this cadence; budget a recurring per-minor upgrade ticket rather than treating upgrades as free.count() feature parity per bridge.pgvector schema updates).StoreInterface bindings in AppServiceProvider.config/caching for store configurations.count(); track these in one package so upgrades are single-file changes.TextDocument input (e.g., empty text, malformed metadata).HybridQuery syntax and backend-specific filters (e.g., Elasticsearch DSL).count() may not honour filters identically across bridges—verify semantics before surfacing to users.Indexer::index() batch size and chunking parameters; now tunable per run via indexer options.#ai channel for real-time support.search(limit: N) fallback for count().ai-redis-store with Redis Cluster for distributed vector storage.count() and read queries to replicas where the bridge supports connection selection, keeping write-path indexing on the primary.count() removes the "fetch N to count" anti-pattern, materially reducing payload size and DB egress on paginated search UIs.How can I help you explore Laravel packages today?