Recommendation API
Overview
The Recommendation API supports searching the indexed archive for articles that:
- are semantically similar to a provided article or short text snippet, or
- contain information relevant to a query.
Endpoints
| Endpoint | Description | |
|---|---|---|
| Request | 200 Response | |
| POST /v1/articles/recommend | Search for articles or recommend related articles. | |
| RecommendRequest | RecommendResponse | |
POST /v1/articles/recommend
Search for articles or recommend related articles.
- Request: RecommendRequest
- Response: RecommendResponse
Examples
Request with text snippet
Request
{
"textSnippet": "How old is the universe?",
"language": "en",
"mode": "similarity",
"maxArticles": 1,
"returnFields": ["paraSpecs"]
}
Response
{
"articles": [
{
"id": "https:||www.snexplores.org|article|new-older-age-universe",
"score": 0.8147907257080078,
"paraSpecs": [
{
"type": "TITLE",
"text": "New, older age for the universe"
},
{
"type": "BODY",
"text": "This map shows the energy left over from shortly after the Big Bang, as mapped by the Planck space telescope. ..."
}
]
}
]
}
Request with article
Request
{
"article": {
"id": "https:||www.snexplores.org|article|a-star-called-earendel-could-be-the-most-distant-ever-seen",
"paraSpecs": [
{
"type": "TITLE",
"text": "A star called 'Earendel' could be the most distant ever seen"
}
]
},
"mode": "similarity",
"minScore": 0.4
}
Response
{
"articles": [
{
"id": "https:||www.snexplores.org|article|oldest-most-distant-galaxy-found",
"score": 0.4263215959072113
},
{
"id": "https:||www.snexplores.org|article|galaxy-cluster-creates-magnifying-glass-space",
"score": 0.41312193870544434
},
{
"id": "https:||www.snexplores.org|article|scientist-say-light-year",
"score": 0.4108744263648987
}
]
}