Rerank
Create a rerank request
Rerank a list of documents by relevance to a query. Returns a relevance score and ordering index for each document.
post/rerank
Request body
Example request
{
"query": "What animals can I find near Peru?",
"documents": [
"Our solar system orbits the Milky Way galaxy at about 515,000 mph"
],
"top_n": 2,
"return_documents": true,
"rank_fields": [
"title",
"text"
]
}Response
200
Example response
{
"id": "9dfa1a09-5ebc-4a40-970f-586cb8f4ae47",
"model": "salesforce/turboranker-0.8-3778-6328",
"results": [
{
"index": 0,
"relevance_score": 0.29980177813003117,
"document": {
"text": "{\"title\":\"Llama\",\"text\":\"The llama is a domesticated South American camelid, widely used as a meat and pack animal by Andean cultures since the pre-Columbian era.\"}"
}
},
{
"index": 2,
"relevance_score": 0.2752447527354349,
"document": {
"text": "{\"title\":\"Guanaco\",\"text\":\"The guanaco is a camelid native to South America, closely related to the llama. Guanacos are one of two wild South American camelids; the other species is the vicuña, which lives at higher elevations.\"}"
}
}
]
}