Skip to main content

Module rerank

Module rerank 

Source
Expand description

Provider-agnostic reranking abstractions.

Reranking models reorder a list of documents by relevance to a query. A Model over a rerank wire calls one, and RerankResponse carries both the scored results and token usage.

use rig_core::DynModel;
use rig_core::operation::{Rerank, RerankRequest};

let request = RerankRequest {
    query: "Rust".into(),
    documents: vec!["A systems programming language".into()],
};
let response = model.call(request).await?;

Structsยง

RerankResponse
Ranked documents and normalized provider metadata. Provider-specific response data is available through Self::raw.
RerankResult
A single reranked document result.