Skip to main content

RerankModel

Trait RerankModel 

Source
pub trait RerankModel: WasmCompatSend + WasmCompatSync {
    type Client;

    const MAX_DOCUMENTS: usize;

    // Required methods
    fn make(client: &Self::Client, model: impl Into<String>) -> Self;
    fn rerank(
        &self,
        query: &str,
        documents: Vec<String>,
    ) -> impl Future<Output = Result<RerankResponse, RerankError>> + WasmCompatSend;
}
Expand description

Trait for reranking models that score documents by relevance to a query.

Required Associated Constants§

Source

const MAX_DOCUMENTS: usize

The maximum number of documents that can be reranked in a single request.

Required Associated Types§

Source

type Client

Provider client type used to construct this rerank model.

Required Methods§

Source

fn make(client: &Self::Client, model: impl Into<String>) -> Self

Construct a model handle from a provider client and model identifier.

Source

fn rerank( &self, query: &str, documents: Vec<String>, ) -> impl Future<Output = Result<RerankResponse, RerankError>> + WasmCompatSend

Rerank a list of documents against a query.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§