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 Generic Platform Laravel Package

symfony/ai-generic-platform

A generic platform bridge for Symfony AI that connects the framework's AI components to a common platform abstraction, simplifying configuration and enabling interoperable model integrations within Symfony applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony AI Integration (unchanged): The package bridges Symfony applications with AI capabilities via a standardized interface (AiClientInterface), which Laravel apps can consume as a standalone Composer dependency. v0.14.0 does not alter this contract, so the architectural posture is unchanged.
  • Abstraction Layer — strengthened by v0.14.0: The release adds an Eden AI gateway (feature #2417). This is the second gateway-style addition of note and materially improves the vendor-lock-in story: Eden AI itself is a multi-provider aggregator, so a Laravel app can now reach many upstream models through a single adapter without writing provider-specific code. This reduces one of the previously flagged risks ("laravel apps must still implement provider-specific logic").
  • Observability hooks — new: Two additions improve operational fit:
    • model property on TokenUsage (#1566) enables per-model cost calculation, which is the missing primitive for spend attribution and quota enforcement.
    • Albert carbon footprint exposed as result metadata (#2517) gives a non-functional reporting signal (sustainability/ESG reporting) without custom instrumentation.
  • Reliability of tool calls — improved: Two bug fixes (#2551, #2543) correct tool-call completion and stop-reason reporting. If the Laravel app plans agentic/tool-calling workflows, this release removes a previously undocumented correctness hazard rather than adding features.
  • Event-Driven Potential (unchanged): Messenger-based async workflows remain optional and still require Laravel-side wrappers.

Integration Feasibility

  • Symfony Dependency (unchanged): Feasibility still hinges on whether the app already pulls Symfony components. Nothing in v0.14.0 adds or removes framework coupling.
  • Upgrade cost: low: The changelog contains no deprecations, no removals, and no configuration-surface changes. Bug fixes are internal to tool-call handling. Expected integration effort to move from 0.13.x to 0.14.x is a composer bump plus regression tests on any tool-calling paths.
  • Cost and quota logic — newly feasible: With TokenUsage::model, Laravel code can now persist usage per model and drive billing, per-tenant quotas, or budget alerts from a single table. Previously this required capturing the model name out-of-band.
  • Provider coverage: Eden AI support means the "which provider do we target?" question becomes less blocking — a single gateway credential can cover multiple upstream vendors.

Technical Risk

  • Pre-1.0 semver risk (elevated as the key residual risk): The package remains on 0.x. Under Composer semantics, ^0.14 permits only 0.14.* patches — minor releases like this one can carry breaking changes by convention. This release happens not to, but the upgrade policy must be explicit (pin exact versions or gate minor bumps behind a test run).
  • Laravel–Symfony friction (unchanged): Container binding of AiClientInterface, exception translation into Laravel's handler, and Messenger-vs-queue divergence remain the same integration tax.
  • Cost-visibility risk — reduced: Without the model property, cost overruns were only detectable via provider dashboards. Now they're detectable in-app, which lowers the risk of unnoticed spend.
  • Tool-calling correctness risk — reduced: The two fixes close a class of silent-wrong-answer failures (tool calls reported on stop finish reasons). Teams that built workarounds around this should plan to remove them.
  • New surface area: Eden AI introduces a second gateway configuration path (credentials, routing, model naming). Small but real: validation and secrets management must cover it, even if unused.

Key Questions

  1. Symfony Adoption: Does the Laravel app already use Symfony components? (Unchanged — still the gating question.)
  2. Gateway vs. direct provider: Does Eden AI support let us consolidate to one credential, or does it add a hop we'd rather avoid for latency/compliance reasons?
  3. Cost tracking: Will we adopt TokenUsage::model as the system of record for AI spend, and where does that data live (per-tenant table, billing pipeline)?
  4. Tool-calling reliance: Do we have agentic/tool-call workflows today? If so, this release is effectively a bug-fix upgrade we should take sooner rather than later.
  5. Version policy: Do we pin 0.14.* exactly, and who owns reviewing each 0.x minor for breaking changes?
  6. Alternatives: Have spatie/ai or direct HTTP client calls been evaluated? (Unchanged.)

Integration Approach

Stack Fit

  • Composer-only integration (unchanged, still recommended): Pull symfony/ai-generic-platform:0.14.* plus symfony/http-client; do not introduce the Symfony framework.
  • Service provider binding (unchanged): Bind AiClientInterface in a Laravel service provider, selecting OpenAI, Eden AI, or another gateway via config.
  • New: usage accounting layer: Wrap AI calls in a small Laravel service that records TokenUsage (model, prompt/completion tokens) to a table or event stream. This is the natural place to enforce per-tenant quotas and emit cost metrics.
  • New: metadata passthrough: Persist result metadata (including Albert carbon footprint where relevant) alongside responses if sustainability reporting is in scope; otherwise ignore — it's additive and non-breaking.
  • Alternatives (unchanged): Direct Guzzle calls or Laravel-native AI packages if Symfony overhead is unjustifiable.

Migration Path

  1. Assessment Phase: Audit AI code and, newly, audit any existing cost-tracking or quota logic that could be replaced by TokenUsage.
  2. Proof of Concept: Validate 0.14.0 with the provider(s) actually in use; add a checkpoint exercising tool calls to confirm the fixed behavior.
  3. Incremental Rollout:
    • Phase 1: Upgrade the dependency and run regression tests on tool-calling paths; remove any workarounds for the stop-reason bug.
    • Phase 2: Introduce token-usage capture and cost reporting.
    • Phase 3: Optionally add Eden AI as a second gateway for failover or model breadth.
    • Phase 4: Adopt Messenger for async AI tasks (if needed).

Compatibility

  • PHP/Symfony versions: Re-verify the package's composer.json constraints against the app's PHP and Laravel versions; the release does not signal a PHP floor change, but confirm before bumping.
  • Laravel components (unchanged): Watch for HTTP client and queue transport overlap; no new conflicts introduced by this release.
  • Data model additions: The usage-tracking table and metadata persistence are new schema work, not a compatibility issue.

Sequencing

  1. Dependency bump:
    composer require symfony/ai-generic-platform:0.14.* symfony/http-client
    
  2. Service binding (in AppServiceProvider) — add a gateway selector so Eden AI can be configured without code changes:
    $this->app->bind(\Symfony\Component\Ai\AiClientInterface::class, function ($app) {
        return match (config('services.ai.gateway')) {
            'eden'   => new \Symfony\Component\Ai\Client\EdenAiClient(config('services.ai.eden.key')),
            default  => new \Symfony\Component\Ai\Client\OpenAiClient(config('services.ai.openai.key')),
        };
    });
    
  3. Usage recording: Persist TokenUsage (including the new model property) after each call.
  4. Regression pass: Re-run tool-calling tests to confirm #2551 / #2543 behavior, then delete obsolete workarounds.

Operational Impact

Maintenance

  • Dependency management (sharpened): Staying on 0.x means every minor bump needs review. Set a policy — pin 0.14.*, review each minor in a branch, and require a green test suite before merge. This release is a good template for a low-risk bump.
  • Provider-specific logic: Reduced for gateways covered by the package (now including Eden AI); unchanged for anything bespoke (rate limits, retries, prompt management).
  • Cost telemetry upkeep: New but small — the usage table needs retention/aggregation rules to avoid unbounded growth.
  • Documentation: Add Laravel-specific notes for container binding and, newly, for gateway configuration and token-usage reporting.

Support

  • Debugging (unchanged): Translate Symfony exceptions into Laravel's report() path; keep the try/catch wrapper.
  • Tool-calling diagnostics — improved: Correct finish-reason reporting makes logs more trustworthy when debugging agent loops.
  • Community (unchanged): Still Symfony-first support; keep an internal runbook.

Scaling

  • Performance (unchanged): Sync AI calls block the request lifecycle; push embedding and batch workloads onto queues. The gateway hop added by Eden AI should be measured — it is an extra network segment versus a direct provider call.
  • Cost scaling — newly observable: Per-model token usage enables budget alarms and per-tenant throttles before overruns reach the invoice.
  • Horizontal scaling: Stateless calls scale out; shared state (Redis, usage tables) must be managed centrally.

Failure Modes

Failure Scenario Impact Mitigation
Symfony 0.x minor breaking change App fails to boot after a routine bump Pin 0.14.*; review each minor in a branch before merge
AI provider API outage Feature degradation Eden AI or a second gateway as fallback; graceful degradation
Gateway hop latency/outage (Eden AI) Slower or failed AI calls Benchmark against direct provider; keep direct path as fallback
Messenger transport failure Async AI tasks fail silently Laravel queue listeners with retries and alerting
Rate limiting by provider Throttled requests Laravel middleware for rate limiting; per-tenant quotas from usage data
Silent cost overrun Budget surprise Alert on TokenUsage model/token aggregates; enforce quotas
PHP memory limits Large responses crash worker queue:work --memory and response size caps

Ramp-Up

  • Onboarding: Developers still need to learn Symfony's AI components alongside Laravel patterns; the new gateway and usage-metadata features add a short amount of surface but no new paradigm.
  • Training materials: Cheat sheet covering (a) binding Symfony services in Laravel's container, (b) exception translation, (c) gateway configuration including Eden AI, (d) reading token usage for cost reports, (e) async workflows.
  • Tooling: Artisan commands to validate provider/gateway configuration, smoke-test a tool-calling round trip, and emit a cost summary from stored token usage.
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.
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge