Rerank search results by relevance
morph-rerank-v4 model achieves state-of-the-art performance across all coding benchmarks for accuracy:speed ratio - no rerank model comes close. Unlike the Apply and Embedding endpoints, the Rerank API uses a custom endpoint specifically designed for reranking tasks.
morph-rerank-v4 with state-of-the-art performance across all code benchmarks for its speed-accuracy ratio.
top_n request parameter is optional and will default to the length of the documents field. Result documents will be sorted by relevance, and the index property can be used to determine original order.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model ID to use for reranking. Use morph-rerank-v4. |
query | string | Yes | The search query to compare documents against. |
documents | array | No* | An array of document strings to be reranked. Required if embedding_ids is not provided. |
embedding_ids | array | No* | An array of embedding IDs to rerank. Required if documents is not provided. Remote content storage must be enabled. |
top_n | integer | No | Number of top results to return. Default is all documents. |
documents or embedding_ids must be provided.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Reranking request
ID of the model to use for reranking
"morph-rerank-v4"
The search query to compare documents against
"How to implement JWT authentication in Express"
An array of document strings to be reranked. Alternatively, use embedding_ids instead.
[
"This Express.js middleware provides authentication using JWT tokens and protects routes.",
"Express.js is a popular web framework for Node.js applications."
]An array of embedding IDs to rerank (alternative to documents). Remote content storage must be enabled.
["emb_123456789", "emb_987654321"]Number of top results to return
5