- Can I use this package directly in Laravel without Symfony, or do I need to install symfony/ai?
- You’ll need to install `symfony/ai` (≥v0.8.0) as a dependency since this package implements Symfony AI’s `StoreInterface`. For Laravel, use the `symfony/http-client` bridge and bind the store in your service container via a custom provider. Laravel’s facades or service container will then manage the AzureSearchStore instance.
- What Laravel versions are officially supported, and are there any PHP version requirements?
- This package targets PHP 8.2+ and aligns with Laravel 10+. While not Laravel-specific, its Symfony AI dependency requires Laravel 10+ due to PHP 8.2+ constraints. Test thoroughly in your Laravel version, as Symfony AI’s evolving API may introduce compatibility gaps.
- How do I configure Azure AI Search credentials and endpoint in Laravel’s config?
- Add an `azure-search` array to your `config/services.php` with keys like `endpoint` (e.g., `https://your-service.search.windows.net`) and `key` (your Azure Search admin key). The store constructor expects these values, so inject them via Laravel’s service container binding or environment variables.
- Does this support hybrid search (vector + metadata filters) like Azure AI Search’s $filter?
- Yes. The package abstracts Azure Search’s hybrid capabilities, letting you combine vector similarity with metadata filters (e.g., `WHERE category = 'tech'`). This is exposed via Symfony AI’s `StoreInterface` methods like `findNearest()`, where you pass a `Filter` object for metadata constraints.
- What’s the performance impact of using Azure AI Search vs. a local vector store like FAISS?
- Azure AI Search typically adds 100–300ms latency per query due to network round trips, compared to FAISS’s sub-50ms local execution. Mitigate this with client-side caching (e.g., Redis) or batch queries. Benchmark with your workload—high-frequency searches may require reserved capacity or regional optimization.
- How do I handle Azure Search’s eventual consistency in Laravel’s synchronous workflows?
- Azure Search’s asynchronous writes may conflict with Laravel’s transactions. Use explicit retries for critical operations or implement a compensating transaction pattern. For example, wrap store operations in a `try-catch` and log failures to a queue for reprocessing.
- Are there Laravel-specific features like Eloquent model integration or query builder support?
- No. This package is Symfony-centric and lacks Eloquent integration or Laravel’s query builder. You’ll need to manually map Laravel models to embeddings or use a facade to abstract the store. For Eloquent-like patterns, consider a custom repository layer or a package like `spatie/laravel-activitylog` for audit trails.
- What are the cost implications of using Azure AI Search for high-volume queries?
- Azure AI Search charges per operation (e.g., ~$0.0004 per query in the US East region). For 1M queries, expect ~$400/month, compared to Pinecone’s $0.60/1M. Optimize costs with reserved capacity, batch operations, or client-side caching. Always validate pricing with Azure’s [pricing calculator](https://azure.microsoft.com/en-us/pricing/calculator/).
- How do I migrate from this package to another vector store (e.g., Pinecone or Weaviate) later?
- Design a facade or abstract class wrapping the `StoreInterface` to isolate Azure-specific logic. For example, inject `AzureSearchStore` via dependency injection and mock it during testing. Schema migrations may be needed if you rely on Azure-specific features like hybrid filters.
- Is there official Laravel documentation or a tutorial for integrating this with Azure OpenAI?
- No Laravel-specific docs exist, but you can combine this package with Azure OpenAI via Symfony AI’s `ClientInterface`. Example: Use `AzureSearchStore` to retrieve embeddings, then pass them to `AzureOpenAIClient` for completions. Follow Symfony AI’s [RAG example](https://symfony.com/doc/current/ai/rag.html) and adapt for Laravel’s service container.