An Overview of Cohere’s Rerank Model
How Rerank Works
The Rerank API endpoint, powered by the Rerank models, is a simple and very powerful tool for semantic search. Given a query
and a list of documents
, Rerank indexes the documents from most to least semantically relevant to the query.
Get Started
Example with Texts
In the example below, we use the Rerank API endpoint to index the list of documents
from most to least relevant to the query What is the capital of the United States?
.
Request
In this example, the documents being passed in are a list of strings:
Response
Example with Semi-structured Data:
Alternatively, you can pass in a JSON object and specify the fields you’d like to rank over. If you do not pass in any rank_fields
, it will default to the text key.
Request
In the docs
parameter, we are passing in a list of objects which have the key values: ['Title' ,'Content']
. As part of the Rerank call, we are specifying which keys to rank over, as well as the order in which the key value pairs should be considered.
Multilingual Reranking
Cohere’s Rerank models have been trained for performance across 100+ languages.
When choosing the model, please note the following language support:
- Rerank 3.0: Separate English-only and multilingual models (
rerank-english-v3.0
andrerank-multilingual-v3.0
) - Rerank 3.5: A single multilingual model (
rerank-v3.5
)
The following table provides the list of languages supported by the Rerank models. Please note that performance may vary across languages.