# Reranking with Cohere
[EN] Source: https://mastra.ai/examples/rag/rerank/reranking-with-cohere

When retrieving documents for RAG, initial vector similarity search may miss important semantic matches.

Cohere's reranking service helps improve result relevance by reordering documents using multiple scoring factors.

```typescript
import {
  rerankWithScorer as rerank,
  CohereRelevanceScorer
} from "@mastra/rag";

const results = rerank({
  results: searchResults,
  query: "deployment configuration",
  scorer: new CohereRelevanceScorer('rerank-v3.5'),
  {
    topK: 5,
    weights: {
      semantic: 0.4,
      vector: 0.4,
      position: 0.2,
    },
  },
);
```

## Links

- [rerank() reference](/reference/rag/rerankWithScorer)
- [Retrieval docs](/docs/rag/retrieval)


---
title: "Example: Reranking with ZeroEntropy | RAG"
description: Example of using Mastra to improve document retrieval relevance with ZeroEntropy's reranking service.
---