Skip to main content

Create rerankings

POST /projects/:projectid/rerank

Score candidate documents against a query.

Authenticates a project API key, then sends the query and candidate documents to Intellectible's hosted reranking worker. Scores are returned in the same order as the submitted documents.

Authentication​

  • Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format: proj.<keyId>.<secret>.
  • Required permission: rerank.create on all.

Path parameters​

NameTypeRequiredDefaultDescription
projectidstringYes-The project id.

Request body​

Content type: application/json

NameTypeRequiredDefaultDescription
querystringYes-The search query to score documents against.
documentsstring[]Yes-A non-empty array of candidate documents.

Example​

{
"query": "What is the cancellation policy?",
"documents": [
"Customers may cancel before their renewal date.",
"Refunds are available for damaged physical goods."
]
}

Example request​

curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"query":"What is the cancellation policy?","documents":["Customers may cancel before their renewal date.","Refunds are available for damaged physical goods."]}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/rerank

Responses​

200​

One score for each submitted document, in input order.

{
"data": [
{
"score": 0.93
},
{
"score": 0.17
}
]
}

400​

query or documents is missing, empty, or malformed.

401​

Missing, invalid, or disabled project API key.

403​

The key is not permitted to create rerankings.

502​

The queue service or reranking worker could not complete the request.