Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Ai Ollama Platform

Ai Ollama Platform Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Ollama platform bridge for Symfony AI

Frequently asked questions about Ai Ollama Platform
How do I install symfony/ai-ollama-platform in a Laravel application?
Install it with Composer and make sure a running Ollama instance is reachable from your application. Because the package is Symfony-first, plan to add Laravel service providers or facades and replace Symfony HttpClient or Messenger usage with Laravel Http, Guzzle, or queues where needed. It targets PHP 8.1+, so confirm your Laravel version meets that constraint before adopting it.
Does symfony/ai-ollama-platform work with Laravel out of the box?
Not natively. Laravel has no built-in Symfony AI support, so you must build custom facades, services, or adapters around the bridge. The Symfony HttpClient dependency is the main hurdle and can be replaced with Laravel Http or Guzzle. Streaming and async work may also need Laravel events, queues, Swoole, or ReactPHP.
What Laravel and PHP versions are supported by this Ollama bridge?
The package targets PHP 8.1 or newer, which generally points to Laravel 9+ or a manually upgraded application. Always check the Composer constraints for the exact Symfony AI and PHP requirements. The v0.14.0 release is an additive, non-breaking minor update, so existing integrations should remain compatible if your DTOs account for the new TokenUsage model field.
How do I configure Ollama for chat and embeddings in Laravel?
Run Ollama locally or in your infrastructure and point the Symfony AI Ollama platform at its HTTP API endpoint. In Laravel, wrap that configuration in config/services.php or a custom service provider and cache model catalog data in Redis or the database. Use the official Ollama API reference for chat, embed, and NDJSON endpoints, and Modelfile docs to understand model capabilities.
Can I use NDJSON streaming with Laravel queues or broadcasting?
Streaming works through NDJSON, but Laravel’s synchronous request lifecycle usually needs adjustment. Consume streams in a queued job, a Swoole or ReactPHP loop, or a dedicated service, then broadcast tokens with Laravel Echo, Pusher, or custom events. Remember that usage and cost metadata often arrives only when the stream completes, so persist a final usage record after streaming.
How do I track token usage and Ollama model costs in Laravel?
In v0.14.0, TokenUsage includes a model property, so you can store usage rows in an ai_usage table and aggregate costs with Eloquent. Build a migration, model, and aggregation job, then expose dashboards through Nova, Filament, or per-tenant budget reports. For streamed responses, capture final usage at stream completion and normalize model names against the OllamaApiCatalog so cost attribution stays accurate.
Is symfony/ai-ollama-platform suitable for production Laravel applications?
It can be production-ready if you encapsulate it behind your own Laravel services and accept the operational cost of running Ollama. You still need Docker, Kubernetes, or a managed Ollama service plus model pull and update automation, ideally via scheduled Laravel commands. The biggest integration risk is Symfony-specific dependencies, especially HttpClient; streaming should be handled asynchronously rather than in normal web requests.
How do I test Ollama chat and embeddings in a Laravel app?
Use Laravel Http::fake or mock the underlying Symfony HTTP client to test chat and embedding calls without a live Ollama server. Add one integration test against a local Ollama container to validate real API behavior and NDJSON streaming fixtures. After upgrading to v0.14.0, assert that TokenUsage model data maps correctly into your DTOs and persistence layer.
What are alternatives to symfony/ai-ollama-platform for Laravel?
You can call Ollama directly with Laravel Http or Guzzle if you only need simple chat or embeddings. This package is most useful when you want Symfony AI’s platform abstraction and provider-swapping capability without rewriting application logic. Other options include cloud AI SDKs, but they trade local inference and data control for managed infrastructure.
How should I maintain and upgrade this package in a Laravel project?
Treat v0.13 to v0.14 as a drop-in minor upgrade, but verify that your HTTP wrapper and custom DTOs do not depend on the old TokenUsage serialization shape. Add the new model field to usage mapping, refresh your test catalogue, and pin Composer versions until integration tests pass. Because the package is Symfony-first, also maintain your Laravel adaptation layer and watch Symfony AI release notes for changes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums