Example Usage
import { CreateRerankRequestBody } from "@openrouter/sdk/models/operations";
let value: CreateRerankRequestBody = {
documents: [
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
],
model: "cohere/rerank-v3.5",
query: "What is the capital of France?",
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
documents | operations.Document[] | :heavy_check_mark: | The list of documents to rerank. Documents may be plain strings, or structured objects with text and/or image for multimodal models. | [ “Paris is the capital of France.”, “Berlin is the capital of Germany.” ] |
model | string | :heavy_check_mark: | The rerank model to use | cohere/rerank-v3.5 |
provider | models.ProviderPreferences | :heavy_minus_sign: | N/A | { “allow_fallbacks”: true } |
query | string | :heavy_check_mark: | The search query to rerank documents against | What is the capital of France? |
topN | number | :heavy_minus_sign: | Number of most relevant documents to return | 3 |
trace | models.TraceConfig | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | { “trace_id”: “trace-abc123”, “trace_name”: “my-app-trace” } |
user | string | :heavy_minus_sign: | A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider. | user-1234 |