Page MenuHomePhabricator

HTTP error handling for Outlink topic model
Closed, ResolvedPublic

Description

Outlink topic model, a language-agnostic model, expects the following input arguments:

{
   "lang": "en",
   "page_title": "Toni Morrison",
   "threshold": 0.3
}

where lang and page_tile are required, threshold is optional.

It makes prediction based on outlinks associated with a Wikipedia article:

{"prediction": {"article": "https://en.wikipedia.org/wiki/Toni Morrison", "results": [{"topic": "Culture.Biography.Biography*", "score": 0.9615437984466553}, {"topic": "Culture.Biography.Women", "score": 0.8872146010398865}, {"topic": "Geography.Regions.Americas.North_America", "score": 0.7186043858528137}, {"topic": "Culture.Literature", "score": 0.5775054097175598}]}}

We want to return meaningful HTTP error messages in Lift Wing if:

  • no matching article for the given title
  • missing a language
  • missing an article title
  • missing both language and title
  • incorrect argument name e.g. lang vs language
  • threshold value provided not a float

Similar to how we've done on revscoring models in T300270, we will use tornado.web.HTTPError and add the status code and message.

Event Timeline

Change 785112 had a related patch set uploaded (by AikoChou; author: AikoChou):

[machinelearning/liftwing/inference-services@main] outlink: handle http bad request

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

Change 785112 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] outlink: handle http bad request

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