[Discuss] Shift focus from provider plugins to operation type plugins in AI Core
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3559800. --> Reported by: [a.dmitriiev](https://www.drupal.org/user/3235287) >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>[One-line issue summary for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>While investigating what approaches could be applied for <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-13"><a href="https://www.drupal.org/project/ai/issues/3552919" title="Status: Needs work">#3552919: Remove ProviderProxy and use template method pattern</a></span>, I had a thought, that AI Core is mainly focused on the provider plugins and providers themselves. As AI Core is a framework, I believe the focus should be more on operation types that can be executed instead of the providers that exist in the system (and also all providers are placed in standalone separate modules). This discussion is more for 3.x and future release (if at all this will be accepted), as it will require a lot of breaking changes.</p> <p>The idea is to allow the consumers (the modules that use AI features, like ai_ckeditor, ai_translation and so on) to rely more on the operation types they need and then only pass available/chosen provider to operation type class to execute the operation. Currently, the implementation forces the providers to follow the operation type interfaces (or even base classes to extend or traits to use) to make sure that they can execute certain operation. This approach is also being discussed in the above mentioned issue, as there should be some certain pre and post methods executed for all operations and at the moment this can lead to breaking changes, as all providers already are tightly coupled to the operation types they support.</p>
issue