Create Plugin Action for Recipes to check for installed default provider
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3525303. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !682 >>> <p>--- AI TRACKER METADATA ---<br> <strong>Update Summary: </strong>Discuss if we should keep it. Need more feedback.<br> <strong>Check-in Date: </strong>MM/DD/YYYY (US format) [When we should see progress/get an update]<br> <strong>Due Date:</strong> MM/DD/YYYY (US format) [When the issue should be fully completed]<br> <strong>Blocked by:</strong> [#XXXXXX] (New issues on new lines)<br> <strong>Additional Collaborators:</strong> @username1, @username2<br> AI Tracker found here: <a href="https://www.drupalstarforge.ai/" title="AI Tracker">https://www.drupalstarforge.ai/</a><br> --- END METADATA ---</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Currently we have some helper plugin actions that lets you:</p> <ul> <li>Setup an AI Provider if its not setup. Meaning setting up api keys and setting default models.</li> <li>Setup an VDB server with the default embeddings model.</li> <li>Setup an VDB index via the recipe.yml, so that the above recipe runs before hand.</li> </ul> <p>This makes it possible to setup something from scratch very easily. The issue with that is that there would be a lot of recipes that would either require some base recipe or would need you to setup things that might already be setup.</p> <p>It would instead be much easier if the recipe could do a simple check if the operation type it is looking for has a provider installed or if the operation type it is looking for has a default model setup.</p> <p>So it could look something like this:</p> <pre>config:<br>&nbsp; actions:<br>&nbsp;&nbsp;&nbsp; custom_config:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; verifyAiDefaults:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; provider_is_setup<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - openai<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vdb_provider_is_setup:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - milvus<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operation_type_has_provider: <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - chat_with_tools<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operation_type_has_default_model:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - chat_with_tools</pre><p>This is a work around that uses config actions in a way its not meant to be used - for validation of requirements before application, but since any exception rolls back the configuration, it would work.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Discuss if this is a good idea, since its a little bit of an antipattern for recipes.</li> <li>Add a custom plugin action called verifyAiDefault that can verify if a list of operation types has provider and/or default models and that throws exceptions if not.</li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue