Introducing Command R+: Our new, most powerful model in the Command R family.

Learn More

rerank

Improve search performance with a single line of code

Rerank provides a powerful semantic boost to the search quality of any keyword or vector search system without requiring any overhaul or replacement.

Code sample that runs the Cohere API rerank endpoint with only a few lines
Using Cohere to the search quality of any keyword

What's possible with Rerank

Featured image for article

IMPROVE ENTERPRISE SEARCH RESULTS

Enhance search precision when integrated with Elasticsearch or OpenSearch.
Featured image for article

OPTIMIZE E-COMMERCE SEARCH

Improve online customer experience with greater search accuracy and fast response times.
Featured image for article

Boost knowledge base search

Eliminate frustration and wasted time by ensuring that semantic context is always understood.

Cohere Rerank is system agnostic

Implement Rerank proof of concepts in a few minutes, and enterprise production-ready with only a few lines of code.

1import cohere
2co = cohere.Client('{apiKey}')
3
4query = 'What is the capital of the United States?'
5docs = ['Carson City is the capital city of the American state of Nevada.',
6     'The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.',
7     'Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. ',
8     'Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.'
9     ]
10results = co.rerank(query=query, documents=docs, top_n=3, model='rerank-english-v3.0')
1Document Rank: 1, Document Index: 2
2Document: Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. 
3Relevance Score: 0.98
4
5
6Document Rank: 2, Document Index: 3
7Document: Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.
8Relevance Score: 0.28
9
10
11Document Rank: 3, Document Index: 0
12Document: Carson City is the capital city of the American state of Nevada.
13Relevance Score: 0.10

Why Rerank

1

Industry-leading accuracy

Cohere’s embedding performance ensures accurate reranking, even with noisy datasets


2

Customization (fine-tuning)

Cohere’s rerank model can be fine-tuned to further improve domain performance

3

Scalability

Cohere’s powerful inference frameworks optimize throughput and reduce compute requirements

4

Flexible deployment

Cohere’s models can be accessed through a SaaS API, on cloud services (e.g. OCI, AWS SageMaker, Bedrock) and soon through private deployments (VPC and on-premise)

Rerank resources

Featured image for article

Cohere docs

Reranking

Featured image for article

Cohere docs

Reranking Best Practices

Background image for aesthetic purposes

Get started with Cohere today!

Reach out to us and let’s discuss how to improve your search performance.