CrossEncoderModel

Trait CrossEncoderModel 

Source
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§

Source

fn score(&self, query: &str, document: &str) -> RragResult<f32>

Score a single query-document pair

Source

fn score_batch(&self, pairs: &[(String, String)]) -> RragResult<Vec<f32>>

Score multiple query-document pairs in batch

Source

fn model_info(&self) -> ModelInfo

Get model information

Provided Methods§

Source

fn get_attention_scores( &self, query: &str, document: &str, ) -> RragResult<Option<Vec<f32>>>

Get attention scores if supported

Implementors§