pub struct SemanticSimilarityExampleSelector { /* private fields */ }Expand description
Selects examples based on semantic similarity using embeddings.
Implementations§
Source§impl SemanticSimilarityExampleSelector
impl SemanticSimilarityExampleSelector
Sourcepub fn new(embeddings: Arc<dyn Embeddings>, k: usize) -> Self
pub fn new(embeddings: Arc<dyn Embeddings>, k: usize) -> Self
Create a new selector that returns the top-k most similar examples.
Trait Implementations§
Source§impl ExampleSelector for SemanticSimilarityExampleSelector
impl ExampleSelector for SemanticSimilarityExampleSelector
Source§fn add_example<'life0, 'async_trait>(
&'life0 self,
example: FewShotExample,
) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_example<'life0, 'async_trait>(
&'life0 self,
example: FewShotExample,
) -> Pin<Box<dyn Future<Output = Result<(), SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a new example to the selector’s pool.
Source§fn select_examples<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FewShotExample>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn select_examples<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FewShotExample>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Select examples most relevant to the input.
Auto Trait Implementations§
impl Freeze for SemanticSimilarityExampleSelector
impl !RefUnwindSafe for SemanticSimilarityExampleSelector
impl Send for SemanticSimilarityExampleSelector
impl Sync for SemanticSimilarityExampleSelector
impl Unpin for SemanticSimilarityExampleSelector
impl UnsafeUnpin for SemanticSimilarityExampleSelector
impl !UnwindSafe for SemanticSimilarityExampleSelector
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