API Reference
Rank texts relative to a query
POST
/
v1
/
rerank
Rank texts relative to a query
curl --request POST \
--url https://api.synapsai.cloud/v1/rerank \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"top_n": 123,
"max_tokens_per_doc": 123
}
'import requests
url = "https://api.synapsai.cloud/v1/rerank"
payload = {
"query": "<string>",
"documents": ["<string>"],
"top_n": 123,
"max_tokens_per_doc": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"results": [
{
"index": 123,
"relevance_score": 123,
"document": "<string>"
}
]
}Body
application/json
Request to rank texts against a query.
Query string(s) used to rank provided documents. Required.
Documents to rerank; can be a flat list or grouped lists corresponding to multiple queries. Required.
Maximum number of reranked results to return.
Maximum number of tokens to consider per document during reranking.
Response
200 - application/json
Ranking results (pipeline output)
Show child attributes
Show child attributes
⌘I
Rank texts relative to a query
curl --request POST \
--url https://api.synapsai.cloud/v1/rerank \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"top_n": 123,
"max_tokens_per_doc": 123
}
'import requests
url = "https://api.synapsai.cloud/v1/rerank"
payload = {
"query": "<string>",
"documents": ["<string>"],
"top_n": 123,
"max_tokens_per_doc": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"results": [
{
"index": 123,
"relevance_score": 123,
"document": "<string>"
}
]
}