Rerank documents
POST
/v1/rerank
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/v1/rerank"
payload := strings.NewReader("{ \"model\": \"rerank-english-v2.0\", \"query\": \"example\", \"documents\": [ {} ], \"top_n\": 1, \"return_documents\": false }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.mirapi.ai/v1/rerank';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"rerank-english-v2.0","query":"example","documents":[{}],"top_n":1,"return_documents":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mirapi.ai/v1/rerank \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "rerank-english-v2.0", "query": "example", "documents": [ {} ], "top_n": 1, "return_documents": false }'Reranks a list of documents by relevance to the query
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Documents reranked
Media typeapplication/json
object
id
string
results
Array<object>
object
index
integer
relevance_score
number
document
object
meta
object
Examplegenerated
{ "id": "example", "results": [ { "index": 1, "relevance_score": 1, "document": {} } ], "meta": {}}