symfony/ai-ollama-platform
Symfony AI bridge for the Ollama platform. Connect Symfony AI to Ollama’s chat and embedding APIs, including NDJSON streaming, using Ollama models and Modelfile capabilities. Links to docs, issues, and contributions in the main Symfony AI repo.
HttpClient in Laravel’s Http facade or Guzzle). The Provider abstraction (v0.8.0) and model routing are valuable but need Laravel-specific implementations (e.g., service providers, interfaces).Messenger, AI traits) would need replacement or abstraction.symfony/ai support → Custom facades/services required.Messenger → Laravel Queues/Horizon for async tasks.HttpClient → Laravel’s Http facade or Guzzle.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Abstraction Leakage | High | Isolate Symfony dependencies behind Laravel interfaces (e.g., OllamaClientInterface). |
| Streaming in Laravel | High | Test NDJSON streaming with Laravel’s event system (e.g., broadcasting, queues). |
| Ollama Infrastructure | Medium | Use Docker/Kubernetes for Ollama; monitor model updates and resource usage. |
| PHP Version Lock | Medium | Use php:8.1 in Docker or upgrade Laravel to 9+. |
| Model Catalog Management | Low | Cache models in Laravel’s cache or database. |
AI component in Laravel (high effort) or use this package only for HTTP calls (lower effort)?olliwood/ollama-php) be simpler than this Symfony bridge?AI stack stable enough for production? What’s the deprecation policy for this package?olliwood/ollama-php) or Laravel-specific AI packages (e.g., beberlei/ai)?OllamaClient in a Laravel service with Guzzle/Laravel HTTP.use Symfony\Component\AI\Ollama\OllamaClient;
use Illuminate\Support\Facades\Http;
class OllamaService {
public function __construct() {
$this->client = new OllamaClient(
Http::macro('createClient', fn() => Http::client())
);
}
}
ProviderInterface to route models dynamically.interface OllamaModelProvider {
public function getModel(string $name): string;
}
.env variables for API URL).symfony/ai-ollama-platform via Composer.OllamaClient (handle Symfony HTTP client).generate(), chat(), embed()).Provider interface.| Component | Compatibility Notes |
|---|---|
| Laravel HTTP Client | Works if wrapped (Symfony HttpClient → Laravel Http facade or Guzzle). |
| Queues/Messenger | No native support; use Laravel Queues/Horizon for async tasks. |
| Streaming (NDJSON) | May require Swoole/ReactPHP for async streaming; test with Laravel Echo. |
| Service Container | Symfony DI → Laravel IoC; bind services manually in AppServiceProvider. |
| PHP 8.1+ | Laravel 9+ required; older versions need upgrades or Docker isolation. |
OllamaClient for simple requests.Provider interface).symfony/ai-ollama-platform releases (e.g., bug fixes for streaming).tap() or dump() for debugging service interactions.How can I help you explore Laravel packages today?