[Feature]: Issue 45 | Contextual Tagging#313
[Feature]: Issue 45 | Contextual Tagging#313TylerB24890 wants to merge 60 commits intoWordPress:developfrom
Conversation
…on buttons are attached to the panel visibility.
… and function calls with pre-loaded objects.
|
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #313 +/- ##
=============================================
+ Coverage 57.85% 58.07% +0.21%
- Complexity 615 679 +64
=============================================
Files 46 49 +3
Lines 3165 3513 +348
=============================================
+ Hits 1831 2040 +209
- Misses 1334 1473 +139
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@jeffpaul -- Thanks for the feedback! I've resolved 1, 2 & 4 -- see below regarding 3 & 5;
That might be a little challenging with this UI being in the sidebar. We might be better off going with a dedicated modal if we're to support that. Is that something we would want to do as opposed to the sidebar UI?
Clicking the suggestion (outside of the 'X') will automatically create (if new) & assign the post to the term -- but I would have expected the Save button for the post to re-appear, since we changed the post state 🤔 I'll have to see what's going on there.
Personally I feel "Regenerate" makes more sense because the initial button says "Generate", but happy to update it if you prefer. |
dkotter
left a comment
There was a problem hiding this comment.
Handful of suggestions / comments / concerns, happy to talk through any of those as needed.
Would also be great to get some E2E tests here prior to this getting merged.
| @@ -0,0 +1,402 @@ | |||
| # Contextual Tagging | |||
There was a problem hiding this comment.
So not to derail things here but wondering if we can come up with a better name for this than Contextual Tagging. Just my opinion so feel free to ignore but I'm worried too many people will associate that Tagging part of this with WordPress tags, and just assume this only works for tags even though it also works for categories (and presumably other taxonomies in the future).
That said, I don't necessarily have a better option though here's some ideas:
- Content Classification
- Contextual Classification
- Term Suggestions
- Suggested Terms
- Smart Classification
There was a problem hiding this comment.
cc/ @jeffpaul if you have thoughts or feel strongly on Contextual Tagging
There was a problem hiding this comment.
I feel that "terms" isn't something that non-technical site owners will understand means "categories and tags", so let's go with Content Classification or Contextual Classification?
| * @return array<string> List of existing term names. | ||
| */ | ||
| protected function get_existing_terms( string $taxonomy ): array { | ||
| $terms = get_terms( |
There was a problem hiding this comment.
It's not unusual for sites to have thousands or tens of thousands of terms (tags especially). In that scenario, seems we still send all of those to the LLM which won't scale well.
Wondering if we need to take an approach where we don't send any existing terms and instead we check if the returned terms already exist? So basically instead of asking the LLM to only return terms in our defined list, we allow the LLM to return anything and then we remove any that aren't existing terms. May impact the results we end up with but seems better than sending tens of thousands of tags for the LLM to process
… and function calls with pre-loaded objects.
…or the json response.
…d terms. Update system instructions and unit tests accordingly.
Took care of the existing terms being sent to the LLM. We no longer restrict the number of suggestions it will return and instead filter suggestions in post-processing as needed. We do still pass the currently assigned terms, though. I feel this provides it additional context and prevents redundant suggestions. @dkotter I rebased the |
I am seeing image generation/edit code in this PR that shouldn't be here. Wondering if you just need to merge the latest changes from |







What?
Closes #45
This PR introduces Contextual Tagging to the AI Experiments plugin. It allows for one-click AI-powered suggestions for post tags and categories based on a comprehensive analysis of the post's content (as well as title and excerpt). It helps authors apply a relevant and consistent taxonomy, improving content organization, discoverability, and on-site navigation.
Why?
Properly categorizing and tagging content is fundamental to an effective content strategy. It helps readers find related articles and signals relevance to search engines. However, this process is often inconsistent and subjective. This feature removes the guesswork by providing intelligent, context-aware suggestions, leading to a better-organized and more interconnected website.
How?
ContextualTaggingExperiment.editor.PostTaxonomyTypeand inject the Experiment UI (buttons, suggestions)ai_contextual_tagging_content- Filter content before AI processingai_contextual_tagging_suggestions- Filter suggestions after AI processingai_contextual_tagging_strategy- Filter the strategy settingai_contextual_tagging_max_suggestions- Filter the max suggestions settingUse of AI Tools
Testing Instructions
postpost type and confirm the Suggest Categories and Suggest Tags buttons are available in the term selector panels.Screenshots or screencast
Settings UI:

Suggestion UI (block editor):

New Term Suggestions:

Existing Term Suggestions:

Additional Notes
ai_contextual_tagging_strategyfilter, but an inline UI to do so is possible.categoryandpost_tag)