symfony/ai-typesense-store
Typesense Store integrates the Typesense vector database with Symfony AI Store, enabling vector indexing and similarity search via Typesense’s vector search API. Part of the Symfony AI ecosystem, with issues and PRs handled in the main Symfony AI repo.
The symfony/ai-typesense-store package is a specialized vector store adapter for Symfony AI, enabling seamless integration of Typesense as a vector database backend. This aligns well with Laravel/PHP applications leveraging Symfony’s AI ecosystem, particularly for use cases like semantic search, RAG pipelines, or recommendation systems. The package abstracts Typesense’s HTTP API behind Symfony’s StoreInterface, ensuring consistency with other AI store implementations (e.g., Redis, PostgreSQL). Its modular design makes it ideal for AI-driven Laravel applications where vector search is a core feature.
StoreInterface to the Typesense store adapter without conflicts.symfony/ai (v0.8.0+) and typesense/typesense client.symfony/http-client) if custom HTTP logic is needed.add(), find(), remove()), reducing the learning curve for developers familiar with Symfony AI’s abstractions.HNSW settings).symfony/ai? If not, what’s the justification for introducing it now?pgvector) if Typesense fails?The package is optimized for Laravel/PHP applications using Symfony AI, fitting into the following stack layers:
StoreInterface.EmbeddingGenerator, AiClient).Alternatives:
typesense/typesense) with custom Laravel services.vector_dimension=384, metadata fields).composer require symfony/ai typesense/typesense
use Symfony\Component\AI\Store\StoreInterface;
use Typesense\Typesense;
$this->app->bind(StoreInterface::class, function ($app) {
$client = new Typesense([
'nodes' => ['http://typesense.example.com:8108'],
'api_key' => 'your-api-key',
'connection_timeout_seconds' => 2,
]);
return new \Symfony\Component\AI\TypesenseStore\TypesenseStore(
$client,
'your_collection_name'
);
});
$store = $this->app->get(StoreInterface::class);
$store->add([1.2, -0.5, ...], ['category' => 'electronics']); // Add vector
$results = $store->find([1.1, -0.6, ...], 5); // Find nearest neighbors
config('features.typesense_enabled')).^0.8.0). Check the package’s composer.json for constraints.typesense/typesense (v1.x). Verify version compatibility with your Typesense instance.{
"name": "products",
"fields": [
{ "name": "vector", "type": "float[]", "facet": false, "optional": false },
{ "name": "category", "type": "string", "facet": true }
],
"default_sorting_field": "vector"
}
$legacyVectors = DB::table('legacy_vectors')->get();
foreach ($legacyVectors as $vector) {
$store->add($vector->embedding, $vector->metadata);
}
How can I help you explore Laravel packages today?