/rerank
tip
haimaker follows the Cohere API request/response for the rerank API
Overview
| Feature | Supported | Notes |
|---|---|---|
| Cost Tracking | ✅ | Works with all supported models |
| Logging | ✅ | Works across all integrations |
| Fallbacks | ✅ | Works between supported models |
| Loadbalancing | ✅ | Works between supported models |
| Supported Providers | Cohere, Together AI, Azure AI, Jina AI, AWS Bedrock, HuggingFace, Vertex AI, Fireworks AI, Voyage AI |
Quick Start
cURL
curl https://api.haimaker.ai/v1/rerank \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere/rerank-english-v3.0",
"query": "What is the capital of the United States?",
"documents": [
"Carson City is the capital city of the American state of Nevada.",
"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
"Washington, D.C. is the capital of the United States.",
"Capital punishment has existed in the United States since before it was a country."
],
"top_n": 3
}'
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The reranking model to use (e.g., cohere/rerank-english-v3.0) |
query | string | Yes | The search query to rerank documents against |
documents | array | Yes | List of documents to rerank |
top_n | integer | No | Number of top results to return |
Response Format
{
"id": "rerank-abc123",
"results": [
{
"index": 2,
"relevance_score": 0.98,
"document": {
"text": "Washington, D.C. is the capital of the United States."
}
},
{
"index": 0,
"relevance_score": 0.45,
"document": {
"text": "Carson City is the capital city of the American state of Nevada."
}
},
{
"index": 1,
"relevance_score": 0.32,
"document": {
"text": "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan."
}
}
],
"meta": {
"api_version": {"version": "1"},
"billed_units": {"search_units": 1}
}
}
Supported Providers
| Provider | Documentation Link |
|---|---|
| Cohere (v1 + v2 clients) | Usage |
| Together AI | Usage |
| Azure AI | Usage |
| Jina AI | Usage |
| AWS Bedrock | Usage |
| HuggingFace | Usage |
| Infinity | Usage |
| vLLM | Usage |
| DeepInfra | Usage |
| Vertex AI | Usage |
| Fireworks AI | Usage |
| Voyage AI | Usage |