- Can I use this Redis vector store package directly in Laravel, or is it Symfony-only?
- This package is designed for Symfony AI and requires Symfony’s AI Store interface. While Laravel can integrate Symfony components via bridges like `symfony/var-dumper`, you’d need an adapter layer (e.g., a custom Laravel service) to bridge Symfony AI’s store interface with Laravel’s ecosystem. Consider alternatives like `laravel-ai/redis-vector` if you need native Laravel support.
- What Laravel versions and PHP versions does this package support?
- This package doesn’t natively support Laravel—it’s built for Symfony AI. However, Symfony AI itself requires PHP 8.1+ and Symfony 6.4+. If you’re using Laravel, ensure your PHP version aligns with Symfony’s requirements (8.1+) and that your Redis server is 7.0+ for vector search features. Laravel’s Composer constraints will need manual alignment if integrating Symfony components.
- How do I install and configure this package in a Laravel project?
- Since this isn’t a Laravel package, installation requires adding Symfony AI and its Redis store as dependencies via Composer (`composer require symfony/ai symfony/ai-redis-store`). Configure Redis in your Symfony AI store service (e.g., `ai.store.redis`) and use Symfony’s DI container. For Laravel, you’d need to wrap Symfony’s store in a Laravel service provider or facade to inject it into your app’s AI workflows.
- Does this package support hybrid search (e.g., combining keyword and vector queries)?
- Yes, the package leverages Redis’ `FT.SEARCH` with DIALECT 2, which supports hybrid queries combining full-text and vector similarity (KNN). You can filter vectors by metadata (e.g., tags, scores) while performing nearest-neighbor searches. Check Redis’ [vector querying docs](https://redis.io/docs/latest/develop/ai/search-and-query/query/) for syntax examples.
- What are the performance implications of using Redis for vector search in production?
- Redis excels at low-latency vector search for moderate datasets (<1M vectors) but may struggle with high-cardinality or GPU-accelerated workloads. Monitor memory usage (Redis’ `MAXMEMORY` policy) and test query throughput under load. For large-scale apps, consider Redis Cluster or dedicated vector databases like Milvus or Weaviate, which offer horizontal scaling and optimized indexing.
- How do I handle large-scale batch inserts or updates in this Redis store?
- The package abstracts Redis’ `FT.CREATE` and `FT.ADD` commands, but batch operations require manual tuning. Use Redis’ `MSET` or Lua scripts for atomic bulk inserts. For large datasets, pre-index vectors with `FT.CREATE` and batch-load them via pipelining. Monitor Redis’ `blocked_clients` metric to avoid pipeline stalls. Consider chunking operations if latency spikes during high-volume writes.
- Are there alternatives to this package for Laravel that offer similar functionality?
- For Laravel, consider `laravel-ai/redis-vector` (if available) or dedicated vector databases with Laravel drivers like `weaviate/weaviate-client-php` or `milvus-io/milvus`. If you’re open to Symfony, `symfony/ai` with this Redis store is a robust choice, but it locks you into Symfony’s ecosystem. For pure Laravel, explore `predis/predis` with custom Redis vector logic or libraries like `php-ai/ann` for approximate nearest-neighbor search.
- How do I test this Redis vector store in a Laravel CI pipeline?
- Since this isn’t a Laravel package, mock Symfony AI’s store interface in your tests using PHPUnit’s dependency injection. Use a test Redis instance (e.g., Dockerized Redis with AI modules) and verify vector inserts/searches via Redis CLI or `predis/predis`. For Laravel-specific tests, wrap the Symfony store in a Laravel service and test its integration with your AI workflows (e.g., embedding generation, query routing).
- What Redis configuration is required for optimal vector search performance?
- Enable Redis’ AI modules (`redis-server --loadmodule /path/to/redisai.so`) and configure the vector index with `FT.CREATE` using `DIALECT 2` and `KNN` for similarity search. Set `MAXENTRIES` and `DIM` (vector dimension) appropriately, and enable compression if memory is constrained. For production, monitor `used_memory_rss` and adjust `maxmemory-policy` to `allkeys-lru` or `volatile-lru` to balance eviction and performance.
- Will this package work with Laravel’s queue system for async vector operations?
- Yes, but you’ll need to wrap the Symfony AI store in a Laravel queueable job. Use Laravel’s `dispatch()` to defer vector inserts/searches to a queue worker (e.g., `redis` or `database` queue). Ensure your Redis connection is shared across queue workers to avoid connection pool exhaustion. For high-throughput workloads, consider batching queue jobs or using Redis’ pub/sub for event-driven updates.