Fix: Restrict Namer model dropdown to text-generation capable models#1241
Fix: Restrict Namer model dropdown to text-generation capable models#1241raftaar1191 wants to merge 8 commits intoWordPress:trunkfrom
Conversation
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
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
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 thetext_generationcapability 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.
|
Hello! Thanks for the PR. Please fix linting errors. |
…s unavailable in CI)
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: Addedmodel_supports_text_generation()helper method to theAI_Utilstrait that inspectsModelMetadata::getSupportedCapabilities()from the WP 7.0 AI Client and checks for thetext_generationcapability value.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.true(include the model) whengetSupportedCapabilities()is not available, ensuring backward compatibility.How to Test
gpt-4oandtext-embedding-3-small).Closes #1219