sort_by_relevance
Sort documents by their relevance to a specific query using Jina AI's reranking technology. Organize search results or content collections to prioritize information that best matches your topic.
Instructions
Rerank a list of documents by relevance to a query using Jina Reranker API. Use this when you have multiple documents and want to sort them by how well they match a specific query or topic. Perfect for document retrieval, content filtering, or finding the most relevant information from a collection.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>",
"documents": "<documents>"
},
"name": "sort_by_relevance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The query or topic to rank documents against (e.g., 'machine learning algorithms', 'climate change solutions') | |
| documents | Yes | Array of document texts to rerank by relevance | |
| top_n | No | Maximum number of top results to return |