Mirror from https://gerrit.wikimedia.org/g/research/recommendation-api
OTHER License
[!IMPORTANT]
Deprecation Notice
The GapFinder tool will be deprecated between July 1 and 15 2024. For detailed background information, please refer to the Phabricator task T367549.
API Migration
For tools utilizing the API, please migrate to the LiftWing endpoint. Documentation for the LiftWing API can be found here.
UI Alternative
For the user interface, please use the Content Translation tool.
Given a source and target wiki, the API provides source articles missing in the target.
https://api.wikimedia.org/service/lw/recommendation/v1/api?source=en&target=fr&count=3&seed=Apple
[
{
"title": "Plum pox",
"pageviews": 0,
"wikidata_id": "Q1788571",
"rank": 10,
"langlinks_count": 5
},
{
"title": "Applecrab",
"pageviews": 0,
"wikidata_id": "Q19595924",
"rank": 12,
"langlinks_count": 0
},
{
"title": "Flamenco (apple)",
"pageviews": 0,
"wikidata_id": "Q19597233",
"rank": 17,
"langlinks_count": 1
}
]
Make sure you are using at least Python 3.10
Inside a virtualenv and in the root directory of the repo
pip install -e .
gunicorn
Then navigate here to see openapi spec: http://localhost:8080/docs
To check out the API, go to: http://localhost:8080/api/v1/translation?source=en&target=fr&count=3&seed=Apple
You should get a similar response to the Sample Call above
Build the image first.
docker build --target production --tag recommendation-api:latest -f .pipeline/blubber.yaml .
Then run:
docker run recommendation-api:latest
Build the image first.
docker build --target test --tag recommendation-api-test:latest -f .pipeline/blubber.yaml .
Then run:
docker run recommendation-api-test:latest
To run load testing using Locust, run
locust -f recommendation/test/locustfile.py
Then navigate to http://localhost:8089/ to run the tests. Provide number of users and API host to test.
All configuration variables defined on configuration.py can be overridden by setting the corresponding environment variable.
You may use a .env file or by setting the environment variables directly in shell.
Refer https://docs.pydantic.dev/latest/concepts/pydantic_settings/ for more options