Improve UX for Embeddings explorer to be aware when image embeddings are allowed
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3584853. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>The Embeddings AI API Explorer always shows both a text field and an image field, even though most embedding models do not support images - hide or disable the image field based on the selected model's capabilities.<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The Embeddings AI API Explorer (<code>modules/ai_api_explorer/src/Plugin/AiApiExplorer/EmbeddingsGenerator.php</code>, at <code>/admin/config/ai/explorers/embeddings_generator</code>) currently renders both the text input field and the image upload field unconditionally.</p> <p>The vast majority of embedding models only support text embeddings. Image embeddings are a much rarer capability. Showing the image field to users who have selected a text-only embeddings model is misleading - it implies the model will accept an image, and when a user tries it they either get a silent no-op or a confusing error from the provider. This makes the explorer feel broken when it is actually working as intended.</p> <p>The explorer already knows which provider and model the user has selected. The AI provider plugin system has the capability to declare what operation variants a given model supports, so the explorer should be able to decide whether image embeddings are available for the current selection and adjust the form accordingly.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add a new case to the <code>AiModelCapability</code> enum in <code>src/Enum/AiModelCapability.php</code> (e.g. <code>EmbeddingsImage = 'embeddings_image'</code>) that declares whether a given embeddings model supports image embeddings. Extend <code>getBaseOperationType()</code> to map it to <code>embeddings</code>.</li> <li>Providers set this capability on each model they expose, based on what the underlying API supports.</li> <li>Update the Embeddings explorer (<code>modules/ai_api_explorer/src/Plugin/AiApiExplorer/EmbeddingsGenerator.php</code>) to read this capability for the currently selected provider/model and show the image field only when the capability is present. When not present, hide or disable the image field and show helper text explaining that the selected model does not support image embeddings.</li> <li>Re-evaluate on model change via AJAX so switching to or from an image-capable model updates the form without a full reload.</li> <li>Document the new capability so provider authors know when to set it.</li> <li>Add a CHANGELOG entry noting that an image embeddings model capability was added and that the Embeddings explorer now adapts its fields based on it.</li> <li>Consider similar treatment in other explorers where operation variants differ per model (out of scope for this issue, but worth noting).</li> </ul> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[x] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> [ ] AI Generated Code<br> [ ] Vibe Coded</p> <p>- <strong>This issue was created with the help of AI</strong></p>
issue