pub struct EmbeddingsFilter { /* private fields */ }Expand description
Filters documents based on cosine similarity between the query embedding and document content embeddings.
Implementations§
Source§impl EmbeddingsFilter
impl EmbeddingsFilter
Sourcepub fn new(embeddings: Arc<dyn Embeddings>, threshold: f32) -> Self
pub fn new(embeddings: Arc<dyn Embeddings>, threshold: f32) -> Self
Create a new EmbeddingsFilter with the given embeddings provider and similarity threshold.
Sourcepub fn with_default_threshold(embeddings: Arc<dyn Embeddings>) -> Self
pub fn with_default_threshold(embeddings: Arc<dyn Embeddings>) -> Self
Create a new EmbeddingsFilter with the default threshold of 0.75.
Trait Implementations§
Source§impl DocumentCompressor for EmbeddingsFilter
impl DocumentCompressor for EmbeddingsFilter
Source§fn compress_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compress_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Compress or filter documents based on relevance to the query.
Auto Trait Implementations§
impl Freeze for EmbeddingsFilter
impl !RefUnwindSafe for EmbeddingsFilter
impl Send for EmbeddingsFilter
impl Sync for EmbeddingsFilter
impl Unpin for EmbeddingsFilter
impl UnsafeUnpin for EmbeddingsFilter
impl !UnwindSafe for EmbeddingsFilter
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