API
Rerank
Reorder candidate documents by relevance to a query.
Overview
Rerank endpoints score a list of documents against a query. They are useful after vector retrieval when you need a smaller, higher-quality context set.
Request
`POST https://uouo.cloud/v1/rerank`
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Rerank model ID. |
| query | string | Yes | Search query or user question. |
| documents | array<string> | Yes | Candidate documents. |
| top_n | integer | No | Number of results to return. |
| return_documents | boolean | No | Include original document text in results. |
Example
curl https://uouo.cloud/v1/rerank \
-H "Authorization: Bearer $UOUODUO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rerank-v3",
"query": "How do I rotate an API key?",
"documents": [
"Create a new key, deploy it, then revoke the old key.",
"Use the billing page to review invoices."
],
"top_n": 1
}'Notes
- Keep documents concise; long documents increase cost and latency.
- Rerank scores are relative to the submitted candidate list.
- Combine embeddings for broad retrieval and rerank for final ordering.