pub struct ConfidenceCrossEncoder { /* private fields */ }Expand description
Confidence-based cross-encoder implementation
This implementation uses semantic similarity and confidence metrics to rerank results. For production use with actual transformer models, consider using ONNXCrossEncoder or APICrossEncoder implementations.
Implementations§
Source§impl ConfidenceCrossEncoder
impl ConfidenceCrossEncoder
Sourcepub fn new(config: CrossEncoderConfig) -> Self
pub fn new(config: CrossEncoderConfig) -> Self
Create a new confidence-based cross-encoder
Trait Implementations§
Source§impl CrossEncoder for ConfidenceCrossEncoder
impl CrossEncoder for ConfidenceCrossEncoder
Source§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 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
Source§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_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
Auto Trait Implementations§
impl Freeze for ConfidenceCrossEncoder
impl RefUnwindSafe for ConfidenceCrossEncoder
impl Send for ConfidenceCrossEncoder
impl Sync for ConfidenceCrossEncoder
impl Unpin for ConfidenceCrossEncoder
impl UnsafeUnpin for ConfidenceCrossEncoder
impl UnwindSafe for ConfidenceCrossEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more