symfony/ai-ollama-platform
Ollama platform bridge for Symfony AI, connecting your applications to locally hosted Ollama models for chat, embeddings, and NDJSON streaming through the Symfony AI component ecosystem.
gemma:2b) for voice-to-text, transcription, or multimodal prompts.TokenUsage now carries the model alongside token counts, enabling per-model cost calculation and chargeback across teams, features, or tenants—useful for metering internal AI usage, forecasting hardware spend, and validating the savings case for self-hosting.symfony/ai; minimal glue code for chat/embeddings.HttpClient) but enables reuse of Ollama’s capabilities.Adopt if:
gemma:2b).Look elsewhere if:
For Executives: *"This package enables local AI deployment using Ollama, cutting cloud API costs and improving latency for internal tools. Key benefits:
llama3 model—in weeks, not months—with real-time streaming responses.
Risk: Requires Ollama server setup (Docker/managed service), but payback is immediate for cost-sensitive or latency-critical use cases."*For Engineering: *"This is a production-ready Ollama client for Symfony/Laravel, handling:
HttpClient (or Laravel’s Http facade with adapters).gemma:2b for audio tasks via Provider abstraction).TokenUsage exposes the model used, so prompt/completion token counts can be priced per model—wire this into your logging/metrics stack without custom parsing.gemma:2b for voice-to-text or audio analysis.
Why not build?OllamaClient in a service using Laravel’s Http facade (see example below).// Laravel Service Example
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())
);
}
public function chat(string $model, string $prompt) {
return $this->client->chat($model, $prompt);
}
}
Caveats:
Provider) need Laravel adapters for full feature parity.For Data/ML Teams: *"This package enables local LLM inference for:
nomic-embed-text) for vector search (e.g., Qdrant, Weaviate).structured_output (v0.7.0) to parse LLM responses into JSON/arrays for ML pipelines.TokenUsage now includes the model (v0.14.0), so per-model token accounting flows straight into experiment tracking and cost dashboards.
Example: Deploy a local RAG system (Retrieval-Augmented Generation) with Ollama + a vector DB, avoiding cloud API costs.
Limitations:llama3)."*How can I help you explore Laravel packages today?