Skip to content

Conversation

@jamesmorrison
Copy link
Contributor

@jamesmorrison jamesmorrison commented Nov 24, 2025

What?

Closes #11

Why?

This PR introduces the logic for generating Excerpts.

How?

We want to add a feature for Excerpt Generation and this is the start of that work. Decided instead of having everything be in a single PR I'd break things down into smaller chunks in order to hopefully speed up reviews and testing. This contains the initial feature class that registers an ability to generate one or more titles from content.

There will need to be followup PRs to handle (at least) the following:

  1. Functionality to actually generate ex excerpts
  2. A new Ability to set an except
  3. Add in needed settings including the ability to disable/enable the feature
  4. Add in the needed UI to actually run the feature

Testing Instructions

Testing Instructions for Keyboard

There is no UI yet but can be tested by making direct API requests to the endpoint using an application password.

  1. In your profile, create an application password.
  2. Make a CURL request to the site with your credentials:
curl -X POST "https://wordpress-ai.test/wp-json/wp-abilities/v1/abilities/ai/excerpt-generation/run" \
  -u "your-username:application-password" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "content": "This is a sample article about artificial intelligence and machine learning. AI has revolutionized many industries including healthcare, finance, and transportation. Machine learning algorithms can now process vast amounts of data to identify patterns and make predictions that were previously impossible.",
      "candidates": 3
    }
  }'

You should see a response like this:

{"excerpts":["Artificial intelligence (AI) and machine learning (ML) are transforming various sectors, including healthcare, finance, and transportation. This article explores how these technologies have revolutionized industries by enabling the analysis of vast datasets to uncover patterns and generate predictions that were once beyond reach. With AI's ability to enhance decision-making processes and improve operational efficiency, organizations are increasingly leveraging ML algorithms to stay competitive in today's data-driven landscape. Discover the profound impact of AI and ML on our world and how they continue to shape the future of innovation.","Artificial intelligence (AI) and machine learning (ML) are transforming industries by enabling unprecedented data processing capabilities. This article explores how these technologies are revolutionizing sectors such as healthcare, finance, and transportation. With advanced machine learning algorithms, organizations can analyze vast datasets to uncover patterns and generate predictions that were once beyond reach. By harnessing the power of AI, businesses are improving efficiency, enhancing decision-making, and driving innovation. Dive into the world of AI and discover how it is shaping the future of various fields, making processes smarter and more effective than ever before.","Artificial intelligence (AI) and machine learning (ML) have transformed various sectors, including healthcare, finance, and transportation, by enabling unprecedented data processing capabilities. This article explores how AI technologies leverage machine learning algorithms to analyze massive datasets, uncovering patterns and making predictions that were once thought to be unattainable. With advancements in these fields, industries are experiencing enhanced efficiency and innovation, leading to improved decision-making and outcomes. Discover the profound impact of AI and ML on our world and how they are shaping the future of technology and business."]}

Alternatively, this can be checked in postman (with the same username and application password)

Screenshots or screencast

Screenshot from CURL command:
Screenshot 2025-11-24 at 16 30 40

Screenshot from Postman:
Screenshot 2025-11-24 at 16 32 56

@github-actions
Copy link

github-actions bot commented Nov 24, 2025

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @nholzmann.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: nholzmann.

Co-authored-by: jamesmorrison <[email protected]>
Co-authored-by: dkotter <[email protected]>
Co-authored-by: mindctrl <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: Ref34t <[email protected]>
Co-authored-by: karmatosed <[email protected]>

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

@jeffpaul jeffpaul added this to the 0.2.0 milestone Nov 25, 2025
@jeffpaul jeffpaul requested a review from dkotter November 25, 2025 14:03
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

Overall looks good as a starting base for this Experiment. Left a few minor comments and there's also a PHPCS failure that needs cleaned up: https://github.com/WordPress/ai/actions/runs/19641726991/job/56246694268?pr=96

@jeffpaul jeffpaul changed the base branch from trunk to develop November 26, 2025 22:08
@jeffpaul jeffpaul modified the milestones: 0.1.1, 0.2.0 Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 62.72727% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.91%. Comparing base (07e92e1) to head (5e4a608).
⚠️ Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
...bilities/Excerpt_Generation/Excerpt_Generation.php 67.02% 31 Missing ⚠️
...eriments/Excerpt_Generation/Excerpt_Generation.php 33.33% 10 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             develop      #96       +/-   ##
==============================================
+ Coverage      27.33%   38.91%   +11.57%     
- Complexity       152      176       +24     
==============================================
  Files             14       16        +2     
  Lines            900     1010      +110     
==============================================
+ Hits             246      393      +147     
+ Misses           654      617       -37     
Flag Coverage Δ
unit 38.91% <62.72%> (+11.57%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jamesmorrison
Copy link
Contributor Author

@dkotter I've gone through the feedback here; I've tested and confirmed this works, screenshot attached from Postman showing the single excerpt with ~50 words.

Please let me know if there's anything else needed here!

Screenshot 2025-12-02 at 11 15 09

@jeffpaul jeffpaul requested a review from dkotter December 3, 2025 18:15
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

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

Overall things look good here, have left a handful of minor comments that need addressing but then this will be good to go.

@jeffpaul Curious on your thoughts here as far as next steps. Since this PR adds the base functionality for generating excerpts but doesn't add the UI yet, we could end up in a scenario where we merge this and before the UI part is finished, we want to do another release. This would result in partially finished work being released.

That's not the end of the world so is an option but we could also do one of the following:

  1. Create a new branch (i.e. experiment/excerpt-generation) to use as our based. This PR could be merged into that instead of develop and the UI portion would then branch off of that. Downside here is we then need a final PR that merges that branch into develop
  2. We could merge this into develop but could first remove the registration of the Experiment. So the code would go out in the next release but this wouldn't show on the settings page or be usable until the UI is done

@jamesmorrison
Copy link
Contributor Author

@dkotter @jeffpaul I've gone through all the feedback, thanks for this. I've completed the requested changes, please let me know if there's anything else needed here.

@jeffpaul
Copy link
Member

jeffpaul commented Dec 5, 2025

@jeffpaul Curious on your thoughts here as far as next steps. Since this PR adds the base functionality for generating excerpts but doesn't add the UI yet, we could end up in a scenario where we merge this and before the UI part is finished, we want to do another release. This would result in partially finished work being released.

The only folks who'd really see or benefit from it would be extenders, until the UI exists non-technical users won't have any benefit so I'm fine with the phased approach here even across releases.

@jeffpaul jeffpaul merged commit 96eb8df into WordPress:develop Dec 5, 2025
22 of 23 checks passed
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.

Excerpt Generation

4 participants