- Can I use this package directly in Laravel, or do I need Symfony?
- This package is part of Symfony AI and requires Symfony’s dependency injection system. For Laravel, you’ll need to integrate it via Symfony’s bridge (like `symfony/ux-live-component`) or adapt its provider logic into Laravel’s service container. The core functionality relies on Symfony’s AI ecosystem.
- What Laravel versions are officially supported?
- This package doesn’t natively support Laravel—it’s designed for Symfony. However, you can use it in Laravel by manually integrating Symfony’s DI container or leveraging Laravel’s Symfony integration packages (e.g., `laravel/symfony-http-foundation`). Check compatibility with PHP 8.2+ for Laravel 10+.
- How do I configure LM Studio as an AI provider in Laravel?
- Since this package isn’t Laravel-native, you’d need to create a Laravel service provider that wraps Symfony’s `LmStudioClient` or `AiClient` classes. Configure the LM Studio endpoint URL (e.g., `http://localhost:1234/v1`) in Laravel’s `config/services.php` and bind it to a custom AI service interface.
- Does this package support fallback to OpenAI if LM Studio fails?
- No, the package lacks built-in retry or fallback logic. You’d need to implement a custom middleware or decorator in Laravel to handle failures (e.g., queue retries or switch to OpenAI via a secondary provider). Symfony AI’s multi-provider strategy can help, but it requires manual setup.
- What are the hardware requirements for running LM Studio locally?
- LM Studio demands significant resources: a modern GPU (NVIDIA RTX 30xx/40xx recommended), 8GB+ RAM, and SSD storage for models. Docker is often used for deployment. Laravel apps using this package must account for these costs, especially in production, where latency and stability are critical.
- How do I test this package in a Laravel CI pipeline?
- Since LM Studio requires local infrastructure, mock its API in tests using Laravel’s HTTP testing tools or a service like WireMock. Test edge cases like rate limits, model failures, and prompt sanitization. Avoid relying on LM Studio’s actual endpoint in CI—use a test double instead.
- Are there alternatives for local LLM integration in Laravel?
- Yes. For Laravel, consider `php-ai/php-ai` (supports local models via ONNX) or `ollama-php/ollama` (for Ollama). These avoid Symfony dependencies and offer more Laravel-native solutions. If you’re tied to OpenAI compatibility, `guzzlehttp/guzzle` with a custom LM Studio client is another option.
- How do I handle input sanitization for LM Studio prompts?
- LM Studio doesn’t sanitize inputs by default, so you must validate prompts in Laravel before sending them. Use Laravel’s `Validator` facade or a library like `spatie/laravel-validation-extensions` to filter malicious or sensitive data. Log sanitized prompts for auditing if compliance is required.
- What’s the performance impact of using LM Studio vs. cloud providers?
- LM Studio typically adds 500ms–2s latency per request due to local inference, compared to 100–300ms for cloud APIs. For high-traffic Laravel apps, consider caching frequent responses (e.g., with `symfony/cache`) or queueing requests to avoid overwhelming LM Studio’s single-process architecture.
- Where should I report bugs or request features for this package?
- Issues and pull requests must be submitted to the [Symfony AI repository](https://github.com/symfony/ai), not this package’s GitHub. Use the `lm-studio` label for LM Studio-specific discussions. The maintainers prioritize Symfony AI’s core features, so Laravel-specific needs may require community contributions.