Options for reranking documents against a query.

interface RerankOptions {
    documents: (string | { [key: string]: string })[];
    model: string;
    parameters?: { [key: string]: string };
    query: string;
    rankFields?: string[];
    returnDocuments?: boolean;
    topN?: number;
}

Properties

documents: (string | { [key: string]: string })[]

The documents to rerank.

model: string

The model to use for reranking.

parameters?: { [key: string]: string }

Additional model-specific parameters. Refer to the model guide for available model parameters.

query: string

The query to rerank documents against.

rankFields?: string[]

The field(s) to consider for reranking. If not provided, the default is ["text"].

The number of fields supported is model-specific.

returnDocuments?: boolean

Whether to return the documents in the response.

topN?: number

The number of results to return sorted by relevance. Defaults to the number of inputs.