Skip to content

Jina AI Rerank Format

Page Overview

Official Documentation

Jina AI Rerank

Standard Format

In 4All API API, Jina AI’s rerank format is used as the standard format. Rerank responses from all other providers (such as Xinference, Cohere, etc.) are normalized into Jina AI’s format to provide a unified developer experience.

Jina AI Rerank is a powerful text reranking model that ranks a list of documents by relevance to a query. The model supports multiple languages, can process text in different languages, and assigns a relevance score to each document.

curl https://4All API地址/v1/rerank \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $4All API_API_KEY" \
-d '{
"model": "jina-reranker-v2-base-multilingual",
"query": "Organic skincare products for sensitive skin",
"top_n": 3,
"documents": [
"Organic skincare for sensitive skin with aloe vera and chamomile...",
"New makeup trends focus on bold colors and innovative techniques...",
"Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille..."
]
}'

Response example:

{
"results": [
{
"document": {
"text": "Organic skincare for sensitive skin with aloe vera and chamomile..."
},
"index": 0,
"relevance_score": 0.8783142566680908
},
{
"document": {
"text": "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille..."
},
"index": 2,
"relevance_score": 0.7624675869941711
}
],
"usage": {
"prompt_tokens": 815,
"completion_tokens": 0,
"total_tokens": 815
}
}
POST /v1/rerank

Include the following in the request header for API key authentication:

Authorization: Bearer $4All API_API_KEY

Where $4All API_API_KEY is your API key.

  • Type: string
  • Required: No
  • Default: jina-reranker-v2-base-multilingual
  • Description: The reranking model to use
  • Type: string
  • Required: Yes
  • Description: The query text used to rank documents by relevance
  • Type: integer
  • Required: No
  • Default: Unlimited
  • Description: Returns the top N ranked documents
  • Type: string array
  • Required: Yes
  • Description: The list of documents to rerank
  • Limit: Each document should not exceed the model’s maximum token limit
  • Type: array
  • Description: The reranked list of documents
  • Properties:
  • document : An object containing the document text
  • index : The index of the document in the original list
  • relevance_score : Relevance score (between 0 and 1)
  • Type: object
  • Description: Token usage statistics
  • Properties:
  • prompt_tokens : Number of tokens used in the prompt
  • completion_tokens : Number of tokens used in the completion
  • total_tokens : Total number of tokens
  • prompt_tokens_details : Prompt token details cached_tokens : Number of cached tokens audio_tokens : Number of audio tokens
  • completion_tokens_details : Completion token details reasoning_tokens : Number of reasoning tokens audio_tokens : Number of audio tokens accepted_prediction_tokens : Number of accepted prediction tokens rejected_prediction_tokens : Number of rejected prediction tokens

When there is an issue with the request, the API returns an error response:

  • 400 Bad Request : Invalid request parameters
  • 401 Unauthorized : Invalid or missing API key
  • 429 Too Many Requests : Rate limit exceeded
  • 500 Internal Server Error : Internal server error
  • Use clear and specific query text
  • Avoid queries that are too broad or vague
  • Make sure the query uses the same language style as the documents
  • Keep documents at a moderate length and do not exceed the model limit
  • Make sure document content is complete and meaningful
  • Multilingual documents are supported, and the model can match across languages
  • Set the top_n parameter appropriately to reduce unnecessary computation
  • For large document sets, consider batch processing
  • You can cache results for frequently used queries

The model supports reranking documents in multiple languages, including but not limited to:

  • English
  • Chinese
  • German
  • Spanish
  • Japanese
  • French

No language parameter is required; the model automatically detects and handles content in different languages.