Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ai Qdrant Store Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Integration Approach

Migration Path

  • Phase 1: Read Operations:
    • Replace search/retrieval logic in critical paths (e.g., recommendation feeds, semantic search) with the Qdrant store.
    • Use feature flags (Symfony’s Feature component) to toggle between old and new stores.
    • Monitor latency and error rates via Symfony’s Monolog or APM tools (e.g., New Relic).
  • Phase 2: Write Operations:
    • Migrate data ingestion pipelines (e.g., embedding generation, batch upserts) to Qdrant.
    • Implement dual-writes during transition to ensure data consistency.
  • Phase 3: Full Cutover:
    • Deprecate legacy vector store code.
    • Update documentation and onboarding for new developers.
  1. Data Migration:
    • Export/Import: Use Qdrant’s export/import tools or custom scripts to migrate existing vectors.
    • Schema Alignment: Ensure payload fields (e.g., metadata) match between old and new stores.
    • Validation: Run data integrity checks (e.g., sample queries, count comparisons) post-migration.

Compatibility

  • Symfony AI Version:
    • Requires Symfony AI 0.8.0+ (check compatibility matrix in Symfony AI docs).
    • Ensure symfony/ai and symfony/ai-qdrant-store versions are aligned to avoid breaking changes.
  • Qdrant Server:
    • Minimum Version: Tested with Qdrant v1.8.0+ (check qdrant/qdrant-client-php requirements).
    • Features: Verify support for required Qdrant features (e.g., HNSW, payload indexing, filtering).
  • PHP Extensions:
    • gRPC: Required for gRPC-based Qdrant deployments (pecl install grpc).
    • HTTP Client: Symfony’s HttpClient is bundled by default (no additional setup for REST).
  • Environment Variables:
    • Configure via .env or Symfony’s parameter bag:
      QDRANT_API_URL=http://qdrant:6333
      QDRANT_API_KEY=your_api_key
      QDRANT_COLLECTION=your_collection_name
      

Sequencing

  1. Prerequisites:
    • Deploy Qdrant (cloud or self-hosted) and validate connectivity.
    • Set up Symfony’s HttpClient with authentication (e.g., API keys, OAuth).
  2. Core Integration:
    • Register the Qdrant store as a service in Symfony’s DI container:
      # config/services.yaml
      Symfony\AI\QdrantStore:
          arguments:
              $client: '@Symfony\Contracts\HttpClient\HttpClientInterface'
              $collection: '%env(QDRANT_COLLECTION)%'
          tags: ['ai.store']
      
    • Configure the store in Symfony AI’s bundle:
      # config/packages/ai.yaml
      framework:
          ai:
              stores:
                  qdrant: ~  # Uses default service ID
      
  3. Advanced Setup:
    • Custom HTTP Client: Extend ScopingHttpClient for middleware (e.g., retries, logging):
      use Symfony\Contracts\HttpClient\ScopedHttpClientInterface;
      
      $client = $httpClient->withOptions([
          'auth_bearer' => '%env(QDRANT_API_KEY)%',
          'timeout' => 5.0,
      ]);
      
    • Collection Management: Dynamically create/update collections:
      $store->getClient()->createCollection('dynamic_collection', [
          'vectors' => ['size' => 768, 'distance' => 'Cosine'],
      ]);
      
  4. Testing:
    • Unit Tests: Mock QdrantClient to test store logic in isolation.
    • Integration Tests: Use a test container for Qdrant (e.g., Dockerized instance):
      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);
          }
      }
      
    • Load Testing: Simulate production traffic using tools like k6 or Locust to validate scalability.

Operational Impact

Maintenance

  • Dependency Updates:
    • Monitor Symfony AI and Qdrant client for breaking changes (e.g., API deprecations).
    • Use Composer scripts to automate version updates:
      {
        "scripts": {
          "update:ai": "composer require symfony/ai:* symfony/ai-qdrant-store:* --update-with-dependencies"
        }
      }
      
  • Qdrant Management:
    • Self-Hosted: Requires monitoring (e.g., CPU, memory, disk) and backups. Use tools like Prometheus + Grafana for observability.
    • Cloud: Managed by provider (e.g., Qdrant Cloud), but monitor costs and quotas.
  • Schema Evolution:
    • Qdrant collections are immutable by default. To modify schemas (e.g., add fields), create a new collection and migrate data:
      # 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
      

Support

  • Troubleshooting:
    • Common Issues:
      • Authentication Errors: Validate API keys and network access (e.g., VPC, firewalls).
      • Timeouts: Adjust HttpClient timeouts or optimize Qdrant’s search parameters (e.g., limit, hnsw_ef).
      • Schema Mismatches: Ensure vector dimensions and payload fields align between client and Qdrant.
    • Debugging Tools:
      • Qdrant Dashboard: Access via http://<qdrant-host>:6333/dashboard for real-time metrics.
      • Symfony Debug Toolbar: Log Qdrant requests/responses for HTTP-based deployments.
  • Vendor Support:
    • Community: Limited to Symfony AI and Qdrant forums (GitHub Discussions, Qdrant Slack).
    • Enterprise: Qdrant Cloud offers SLA-backed support for paid tiers.
  • Documentation Gaps:
    • Symfony AI: Focuses on high-level abstractions; Qdrant-specific details may require cross-referencing Qdrant docs.
    • Mitigation: Create an internal runbook with:
      • Common queries (e.g., "How to filter by payload?").
      • Example configurations (e.g., gRPC vs. REST).
      • Troubleshooting workflows (e.g., "Collection not found" → check collection name case sensitivity).

Scaling

  • Horizontal Scaling:
    • Qdrant: Supports sharding and replication for distributed deployments. Configure via qdrant.yaml:
      service:
        shard_count: 4
        replicas_count: 3
      
    • Symfony: Stateless design allows scaling app servers independently of Qdrant.
  • Performance Tuning:
    • Indexing: Optimize Qdrant’s HNSW parameters (hnsw_ef, hnsw_m) for recall/latency trade-offs.
    • Batch Processing: Use Qdrant’s batch APIs (e.g., 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']],
      ]);
      
    • Caching: Cache frequent queries using Symfony’s Cache component:
      use Symfony\Contracts\Cache\CacheInterface;
      
      $cache = $cachePool->getItem('search_results_'.$query);
      if (!$cache->isHit()) {
          $results = $store->search($query);
          $cache->set($results);
      }
      
  • Resource Limits:
    • Vector Dimensions: Qdrant supports up to 65,535 dimensions, but high-dimensional vectors (e.g., 768+) may impact performance.
    • Payload Size: Limit payload field sizes to avoid serialization overhead.

Failure Modes

  • Qdrant Unavailable:
    • Symptoms: Timeouts, HttpClient exceptions.
    • Mitigations:
      • **Circuit Bre
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi