symfony/ai-qdrant-store
Qdrant Store integrates the Qdrant vector database with Symfony AI Store, enabling you to manage collections and points and run unified vector search with filters. Provides a Symfony-friendly bridge to Qdrant for embedding-based retrieval use cases.
Feature component) to toggle between old and new stores.symfony/ai and symfony/ai-qdrant-store versions are aligned to avoid breaking changes.qdrant/qdrant-client-php requirements).pecl install grpc).HttpClient is bundled by default (no additional setup for REST)..env or Symfony’s parameter bag:
QDRANT_API_URL=http://qdrant:6333
QDRANT_API_KEY=your_api_key
QDRANT_COLLECTION=your_collection_name
HttpClient with authentication (e.g., API keys, OAuth).# config/services.yaml
Symfony\AI\QdrantStore:
arguments:
$client: '@Symfony\Contracts\HttpClient\HttpClientInterface'
$collection: '%env(QDRANT_COLLECTION)%'
tags: ['ai.store']
# config/packages/ai.yaml
framework:
ai:
stores:
qdrant: ~ # Uses default service ID
ScopingHttpClient for middleware (e.g., retries, logging):
use Symfony\Contracts\HttpClient\ScopedHttpClientInterface;
$client = $httpClient->withOptions([
'auth_bearer' => '%env(QDRANT_API_KEY)%',
'timeout' => 5.0,
]);
$store->getClient()->createCollection('dynamic_collection', [
'vectors' => ['size' => 768, 'distance' => 'Cosine'],
]);
QdrantClient to test store logic in isolation.use Symfony\AI\Tests\QdrantStoreTest;
class QdrantStoreTest extends KernelTestCase {
public function testSearch(): void {
$store = self::getContainer()->get('ai.store.qdrant');
$results = $store->search([0.1, 0.2]);
$this->assertCount(5, $results);
}
}
{
"scripts": {
"update:ai": "composer require symfony/ai:* symfony/ai-qdrant-store:* --update-with-dependencies"
}
}
# Export old data
qdrant export --collection old_collection --output old_data.jsonl
# Create new collection
qdrant collection create new_collection --vectors-size 768 --payload-schema '{"fields": [...]}'
# Import data
qdrant import --collection new_collection --input old_data.jsonl
HttpClient timeouts or optimize Qdrant’s search parameters (e.g., limit, hnsw_ef).http://<qdrant-host>:6333/dashboard for real-time metrics.qdrant.yaml:
service:
shard_count: 4
replicas_count: 3
hnsw_ef, hnsw_m) for recall/latency trade-offs.upsert_points) to reduce round trips:
$store->upsert([
['vector' => [0.1, 0.2], 'id' => '1', 'payload' => ['title' => 'Foo']],
['vector' => [0.3, 0.4], 'id' => '2', 'payload' => ['title' => 'Bar']],
]);
Cache component:
use Symfony\Contracts\Cache\CacheInterface;
$cache = $cachePool->getItem('search_results_'.$query);
if (!$cache->isHit()) {
$results = $store->search($query);
$cache->set($results);
}
HttpClient exceptions.How can I help you explore Laravel packages today?