Skip to content

Fix: Restrict Namer model dropdown to text-generation capable models#1241

Open
raftaar1191 wants to merge 8 commits intoWordPress:trunkfrom
raftaar1191:fix/namer-text-model-filter-1219
Open

Fix: Restrict Namer model dropdown to text-generation capable models#1241
raftaar1191 wants to merge 8 commits intoWordPress:trunkfrom
raftaar1191:fix/namer-text-model-filter-1219

Conversation

@raftaar1191
Copy link
Copy Markdown
Contributor

Summary

Fixes #1219.

The model selection dropdown on the Plugin Check Namer tool displayed all available AI models, including those that don't support text-to-text generation (e.g. embedding models, vision-only models, audio models like gpt-4o-audio-preview). This caused confusion and would result in errors when a non-text-generation model was selected and used.

Changes

  • includes/Traits/AI_Utils.php: Added model_supports_text_generation() helper method to the AI_Utils trait that inspects ModelMetadata::getSupportedCapabilities() from the WP 7.0 AI Client and checks for the text_generation capability value.
  • Modified get_filtered_ai_models() to skip models that do not pass the capability check, so only text-generation capable models are returned for the dropdown.
  • The helper gracefully falls back to true (include the model) when getSupportedCapabilities() is not available, ensuring backward compatibility.

How to Test

  1. Ensure you have WordPress 7.0+ with at least one AI connector configured (including a provider that exposes multiple model types, e.g. OpenAI which has both gpt-4o and text-embedding-3-small).
  2. Go to WP Admin → Tools → Plugin Check Namer.
  3. Open the model dropdown.
  4. Verify that only text-generation models are listed — embedding models, audio-only models, and image-generation models should not appear.

Closes #1219

Filters get_filtered_ai_models() to skip models that do not support
the text_generation capability, preventing embedding, vision-only,
and audio models from appearing in the Namer tool's model dropdown.

Adds model_supports_text_generation() helper that uses the
getSupportedCapabilities() API from ModelMetadata (WP 7.0 AI Client).

Fixes WordPress#1219
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: raftaar1191 <raftaar1191@git.wordpress.org>
Co-authored-by: davidperezgar <davidperez@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Filters the Plugin Check Namer’s AI model dropdown to only show models that can perform text generation, reducing user confusion and preventing incompatible selections.

Changes:

  • Added a model_supports_text_generation() helper to detect the text_generation capability from model metadata.
  • Updated get_filtered_ai_models() to exclude models that don’t support text generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@raftaar1191 raftaar1191 changed the title Fix: Restrict Namer model dropdown to text-generation capable models WIP : Fix: Restrict Namer model dropdown to text-generation capable models Mar 26, 2026
@davidperezgar
Copy link
Copy Markdown
Member

Hello! Thanks for the PR. Please fix linting errors.

@raftaar1191 raftaar1191 changed the title WIP : Fix: Restrict Namer model dropdown to text-generation capable models Fix: Restrict Namer model dropdown to text-generation capable models Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict model dropdown to only show text-to-text supported models

3 participants