Page MenuHomePhabricator

Create Production Revise Tone Recommendation Provider
Closed, ResolvedPublic5 Estimated Story Points

Description

In T401194 we created a sub-page based recommendation provider that uses mock data stored on the /tone.json to the articles in question. This will mostly also work as-is in beta. However, for the production release, we will need to get this data from the (Staging) Data Gateway.

That means we will need something similar to the ServiceImageRecommendationProvider/ProductionImageRecommendationApiHandler, except simpler, maybe we don't even need this separation into two classes for ReviseTone. Also, as opposed to how we do it for ImageRecommendations, for ReviseTone we will not need caching here since we only make a single request to the endpoint. We will add monitoring for the performance of this in T407031 and might add caching later, if we learn that we need it.

The request format will be requested by {data-gateway url}/public/ml_cache/page_paragraph_tone_scores/{wiki_id}/{page_id}/{revision_id}

This can be asserted by trying out the following on a deployment server/testwiki shell:

curl https://data-gateway.k8s-staging.discovery.wmnet:30443/public/ml_cache/page_paragraph_tone_scores/testwiki/168753/680406 2>/dev/null |json_pp.

The responses will look like:

{
   "rows" : [
      {
         "content" : "Schwarzwald Castle offers a wonderful glimpse into medieval life with well-preserved ruins and informative guided tours available in multiple languages. The scenic hilltop location provides excellent views of the surrounding Black Forest, making it a popular choice for families and history enthusiasts. The on-site museum showcases an impressive collection of medieval artifacts, and the castle grounds are perfect for a relaxing afternoon visit. With convenient parking and a charming café serving local specialties, Schwarzwald Castle makes for an enjoyable day trip from Freiburg.",
         "idx" : -1,
         "model_version" : "v1",
         "page_id" : 168753,
         "revision_id" : 680406,
         "score" : 0.886,
         "wiki_id" : "testwiki"
      }
   ]
}

Relevant articles have the recommendation.tone tag in CirrusSearch and can be found by: https://test.wikipedia.org/w/index.php?search=hasrecommendation%253Atone

Acceptance criteria:

  • By default, we load the recommendations from an internal service via a URL (to be configured in PHP settings)
  • We continue to use the Subpage-based provider on CI, patch-demo, and beta.

Event Timeline

Michael triaged this task as High priority.Oct 15 2025, 2:21 PM
Michael moved this task from Inbox to Estimated tasks backlog on the Growth-Team board.
Michael added a project: OKR-Work.
Michael set the point value for this task to 5.Nov 10 2025, 11:45 AM

Change #1202224 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/GrowthExperiments@master] feat(ReviseTone): Add setting for the internal DataGateway url

https://gerrit.wikimedia.org/r/1202224

Change #1202224 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] feat(ReviseTone): Add api recommendation provider

https://gerrit.wikimedia.org/r/1202224

This cannot be QAed on its own, let's close it.

Change #1206850 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[operations/mediawiki-config@master] beta: Set wgGEReviseToneRecommendationProvider to subpage

https://gerrit.wikimedia.org/r/1206850

Change #1206850 merged by jenkins-bot:

[operations/mediawiki-config@master] beta: Set wgGEReviseToneRecommendationProvider to subpage

https://gerrit.wikimedia.org/r/1206850