symfony/ai-sqlite-store
SQLite vector store integration for Symfony AI Store. Supports full-text search via SQLite FTS5 and computes vector similarity distances in PHP. Compatible with sqlite-vec (vec0) extension for embedding storage and retrieval.
Store interface, leveraging Laravel’s dependency injection and configuration patterns. This reduces integration complexity for teams already using Symfony components (e.g., HTTP client, UX).sqlite-vec fills a gap in Laravel’s native tooling.symfony/ai (≥v0.8.0), which may necessitate adopting Symfony’s AI abstractions in Laravel. This is feasible but requires alignment with Laravel’s ecosystem (e.g., using symfony/ai alongside Laravel’s existing services).sqlite-vec extension is not bundled with PHP and must be installed manually (e.g., pecl install sqlite-vec). This introduces a deployment dependency that may conflict with shared hosting or CI/CD pipelines.
Store interface, though direct SQL access to the SQLite vector tables (vec0) may require custom logic.sqlite-vec is niche (low adoption, minimal documentation). Risks include:
sqlite-vec, PHP-side distance calculations (e.g., cosine similarity) are O(n)—unsustainable for datasets >100K vectors.:memory:) for development.ai:store Artisan commands or Scout-like facade). Developers must manually configure Symfony AI’s Store service.laravel-ai-sqlite) to abstract Symfony AI’s dependencies.sqlite-vec be reliably installed across all deployment environments (e.g., shared hosting, Docker, serverless)? If not, what’s the impact on vector search functionality?pgvector) or Redis.laravel-backup may need extension.Store interface, which can be integrated into Laravel via Composer (symfony/ai). Laravel’s growing adoption of Symfony components (e.g., HTTP client, UX) reduces friction.sqlite: connection in config/database.php). No additional drivers needed beyond sqlite-vec.symfony/ai-store-doctrine with pgvector for scalability.symfony/ai-store-redis for low-latency, high-concurrency workloads.Store for in-memory or array-based storage (for prototyping).sqlite-vec).sqlite-vec extension:
pecl install sqlite-vec
Add to php.ini:
extension=sqlite-vec.so
config/database.php to include an SQLite connection:
'sqlite' => [
'driver' => 'sqlite',
'database' => database_path('ai_store.sqlite'),
'prefix' => '',
],
composer require symfony/ai symfony/ai-sqlite-store
Store service in Laravel’s service container (e.g., AppServiceProvider):
use Symfony\AI\Store\SQLiteStore;
use Doctrine\DBAL\Connection;
$this->app->singleton('ai.store', function ($app) {
$connection = $app->make(Connection::class);
return new SQLiteStore(
$connection->getWrappedConnection()->getNativeConnection()
);
});
Store interface:
use Symfony\AI\Store\StoreInterface;
public function __construct(private StoreInterface $store) {}
public function searchVectors(array $embeddings) {
return $this->store->findNearest($embeddings);
}
use Symfony\AI\Store\SQLiteStore;
$store = $this->app->make(SQLiteStore::class);
$vectorResults = $store->findNearest($embeddings, 10);
$textResults = $store->findByText($query, 10);
$combinedResults = $store->applyRRF($vectorResults, $textResults);
sqlite-vec and use PHP-side calculations (slower):
$store = new SQLiteStore($connection, false); // Disable vec0
pdo_sqlite (bundled with PHP) and optionally sqlite-vec..schema command or a custom migration.:memory:) for local development.How can I help you explore Laravel packages today?