> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rerank

> Rerank documents with Google Vertex AI

The Prisma AIRS AI Gateway exposes Google Vertex AI's [Discovery Engine ranking API](https://cloud.google.com/generative-ai-app-builder/docs/ranking) through the unified `/v1/rerank` endpoint.

> [!NOTE]
>
> Enable the **Discovery Engine API** on the GCP project backing your Vertex AI provider before making rerank requests.

## Supported Models

* `semantic-ranker-default@latest` (default)
* `semantic-ranker-fast@latest`
* `semantic-ranker-512@latest`
* Specific versions: `semantic-ranker-default-004`, `semantic-ranker-fast-004`, `semantic-ranker-default-003`, `semantic-ranker-default-002`

## Rerank documents

```sh cURL theme={"system"}
curl --location 'https://aigw.portkey.ai/v1/rerank' \
--header 'Authorization: Bearer $PORTKEY_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "@VERTEX_AI_PROVIDER_SLUG/semantic-ranker-default@latest",
    "query": "What is the capital of the United States?",
    "top_n": 3,
    "documents": [
        "Carson City is the capital city of the American state of Nevada.",
        "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.",
        "Washington, D.C. is the capital of the United States.",
        "Capitalization is the use of a capital letter at the start of a word."
    ]
}'
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | Ranking model to use (see supported models) |
| `query` | string | Yes | Query against which documents are ranked |
| `documents` | string\[] \| object\[] | Yes | Documents to rank. Accepts strings or `{ text, title? }` objects (max 200) |
| `top_n` | integer | No | Number of top results to return. Omit to return all |
| `return_documents` | boolean | No | Set to `false` to receive only IDs and scores (default `true`) |

## Related Resources

> **[Google Vertex AI Ranking API](https://cloud.google.com/generative-ai-app-builder/docs/ranking)**
>
> Official documentation for the Vertex AI Discovery Engine ranking API.


## Related topics

- [Rerank](https://docs.portkey.ai/docs/aigw/integrations/llms/bedrock/rerank.md)
- [Create rerank](https://docs.portkey.ai/docs/aigw/api-reference/rerank/create-rerank.md)
- [Azure AI Foundry](https://docs.portkey.ai/docs/aigw/integrations/llms/azure-foundry.md)
- [Jina AI](https://docs.portkey.ai/docs/aigw/integrations/llms/jina-ai.md)
- [Voyage AI](https://docs.portkey.ai/docs/aigw/integrations/llms/voyage-ai.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.