pub trait CrossEncoder: Send + Sync {
// Required methods
fn rerank<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
candidates: Vec<SearchResult>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn score_pair<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<f32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn score_batch<'life0, 'async_trait>(
&'life0 self,
pairs: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Cross-encoder trait for reranking retrieved results
Required Methods§
Sourcefn rerank<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
candidates: Vec<SearchResult>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn rerank<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
candidates: Vec<SearchResult>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RankedResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Rerank a list of search results based on relevance to query
Sourcefn score_pair<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<f32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn score_pair<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<f32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Score a single query-document pair