- Can I use this package with Laravel 10 and Symfony AI?
- Yes, this package is designed for Laravel 10+ and works with Symfony AI. Ensure you pin Symfony dependencies (e.g., `^6.4`) in `composer.json` to avoid version conflicts. Laravel’s dependency injection and HTTP facade integrate smoothly with Symfony’s HttpClient.
- How do I configure Azure API keys and endpoints in Laravel?
- Store keys in `.env` (e.g., `AZURE_OPENAI_API_KEY`, `AZURE_FOUNDRY_ENDPOINT`) and reference them in `config/ai.php`. Laravel’s `.env` caching and Vault support (e.g., HashiCorp) simplify secure key management. Example: `'api_key' => env('AZURE_OPENAI_API_KEY')`.
- Does this support Azure AI Foundry’s Responses API for structured outputs?
- Yes, the package includes `ResponsesModelClient` for Foundry’s structured outputs (e.g., JSON schemas). Pair it with Laravel’s `spatie/laravel-array-to-object` or API resources to map responses to Eloquent models or DTOs cleanly.
- How can I handle rate limits or retries for Azure API calls in Laravel?
- Use Laravel’s `spatie/laravel-retryable` package for automatic retries on failures (e.g., 429 errors). Monitor Azure quotas via Laravel’s task scheduler and cache responses with `cache()->remember()` to reduce API calls.
- Will this work with Laravel Queues for async AI processing?
- Not natively, but you can wrap Azure calls in a custom Laravel job (e.g., `AzureAiJob`). Dispatch the job to handle long-running AI tasks asynchronously, then process results via queue listeners or webhooks.
- Can I switch between Azure OpenAI and Foundry Llama dynamically?
- Yes, the package supports dynamic provider routing via config-driven strategies. Define fallback providers in `config('ai.providers')` and use feature flags (e.g., A/B testing) to switch models at runtime.
- How do I test Azure AI integrations without hitting real endpoints?
- Use Symfony’s `MockHttpClient` to mock Azure responses in tests. Example: `$mockClient = new MockHttpClient(); $client = new ModelClient($mockClient, config('ai.azure'));` Laravel’s HTTP mocking also works for testing.
- Are there alternatives to this package for Laravel?
- For Azure-specific Laravel packages, consider `azure/azure-sdk-for-php` (low-level) or `guzzlehttp/guzzle` with custom wrappers. However, this package offers deeper Symfony AI integration, structured outputs, and multi-provider support out of the box.
- How do I handle Azure authentication with Managed Identity in cloud deployments?
- For Azure Managed Identity, use Laravel’s environment-aware configuration to inject the identity token dynamically. Example: `'auth' => ['managed_identity' => true]`. Ensure your cloud provider (e.g., Azure App Service) has the identity enabled.
- Can I integrate AI responses into Laravel Blade templates?
- Not directly, but you can create a Blade directive or helper function to format AI responses. Example: `@aiResponse($response)` with logic to parse and display structured data. Pair with Laravel’s `collect()` for easy templating.