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.createon all.
Path parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectid | string | Yes | - | The project id. |
Request body
Content type: application/json
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | Yes | - | The search query to score documents against. |
documents | string[] | 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.