> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# cohere_rerank()

> Rerank documents by relevance with complete API response

Rerank documents by semantic relevance and get the complete API response including relevance scores and metadata. For a
simpler response format, use [`cohere_rerank_simple()`][cohere_rerank_simple].

## Arguments

This function accepts the same arguments as [`cohere_rerank_simple()`][cohere_rerank_simple].

## Returns

`JSONB`: The complete API response including results array with indexes, relevance scores, and document metadata.

## Related functions

* [`cohere_rerank_simple()`][cohere_rerank_simple]: simplified response format

[cohere_rerank_simple]: /api-reference/pgai/model-calling/cohere/cohere_rerank_simple
