pub trait CrossEncoderModel: Send + Sync {
// Required methods
fn score(&self, query: &str, document: &str) -> RragResult<f32>;
fn score_batch(&self, pairs: &[(String, String)]) -> RragResult<Vec<f32>>;
fn model_info(&self) -> ModelInfo;
// Provided method
fn get_attention_scores(
&self,
query: &str,
document: &str,
) -> RragResult<Option<Vec<f32>>> { ... }
}Expand description
Trait for cross-encoder models
Required Methods§
Sourcefn score(&self, query: &str, document: &str) -> RragResult<f32>
fn score(&self, query: &str, document: &str) -> RragResult<f32>
Score a single query-document pair
Sourcefn score_batch(&self, pairs: &[(String, String)]) -> RragResult<Vec<f32>>
fn score_batch(&self, pairs: &[(String, String)]) -> RragResult<Vec<f32>>
Score multiple query-document pairs in batch
Sourcefn model_info(&self) -> ModelInfo
fn model_info(&self) -> ModelInfo
Get model information
Provided Methods§
Sourcefn get_attention_scores(
&self,
query: &str,
document: &str,
) -> RragResult<Option<Vec<f32>>>
fn get_attention_scores( &self, query: &str, document: &str, ) -> RragResult<Option<Vec<f32>>>
Get attention scores if supported