Draft: feat: #3586427 Adopt symfony/ai component v0.8 as platform provider

Description

  • New ai_inference_provider plugin type + config entity (one inference backend with API key / base URL / model list); ships Generic (OpenAI-compatible) and Gemini. Plugin namespace Plugin/ai/InferenceProvider/.
  • New ai_model_router plugin type; ships CatalogBasedModelRouter (default).
  • New ai_platform plugin type with two derivers:
    • EntityPlatform — one derivative per ai_platform config entity.
    • DefaultPlatform — one default:<inference_provider_id> per inference provider, auto-exposing every backend as a usable platform without forcing the admin to create an ai_platform entity.
  • ai_platform config entity composes providers + router into a Symfony\AI\Platform\Platform directly — no per-platform plugin layer. New field middlewares: [{ plugin, configuration }] stack applied to the built Platform.
  • New ai_platform_middleware plugin type for cross-cutting wrappers (caching / retry / fallback / tracing). Ships Tracing (Symfony\AI\Platform\TraceablePlatform wrapper). UI sub-form is @todo.
  • Canonical new API: plugin.manager.ai.platform->getPlatformsForOperationType($op): AiPlatformInterface[]. Legacy ai.provider->getProvidersForOperationType() kept and marked @deprecated — returns PlatformProxy BC adapters so 1.x AiProviderInterface / ChatInterface consumers keep working unchanged.
  • Admin UI: /admin/config/ai/inference-providers CRUD; /admin/config/ai/platforms form has provider multi-select + router picker (middleware sub-form is @todo).
  • Addressing: entity:<entity_id> or default:<inference_provider_id> via plugin.manager.ai.platform; ai_platform:entity:<id> / ai_platform:default:<id> via the legacy ai.provider API.
  • Echo fixture migrated (Plugin/ai/InferenceProvider/EchoProvider + split ai.inference_provider.echo_test / ai.platform.echo_test).

Testing instructions

  1. /admin/config/ai/inference-providers → add a provider:
    • Plugin: Generic
    • Base URL + Key entity + models (one per line)
  2. /admin/config/ai/platforms → add a platform entity:
    • Label, providers: select the one from step 2, routing: Catalog-based
    • (Middleware sub-form is @todo — field is a hidden value placeholder.)
  3. /admin/config/ai/settings → for the chat operation, try both:
    • ai_platform:default:<inference_provider_id> (auto-derived single-provider platform — no entity required), and
    • ai_platform:entity:<your_platform_id> (the explicit platform from step 3).
  4. /admin/config/ai/ai-api-explorer/chat-generation → send a prompt with each → both reply.

Checklist

  • I have linked the related issue in the MR title or description
  • I have performed a self-review of my own code
  • I have added or updated tests, or explained in the description why this change is not covered by tests
  • I have updated documentation for any new or changed functionality
  • I have written testing instructions and verified them locally
  • I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
  • This MR contains no breaking API or hook changes, or they are explicitly documented in the description

AI Compliance

Note

Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.

  • AI Assisted Code
    Mainly written by a human; AI used for autocomplete or partial generation under full human supervision.

  • AI Generated Code
    Mainly generated by AI, reviewed and approved by a human before this MR was created.

  • Vibe Coded
    Generated by AI and only functionally reviewed before this MR was created.

Closes #3586427

Edited by Wolfgang Ziegler

Merge request reports

Loading