pub struct SentenceTransformerProvider { /* private fields */ }Expand description
Sentence-transformer embedding provider for documentation.
Optimised for natural language paragraphs rather than code. Pre-processes markdown, splits into sentences, embeds each, and averages (mean pooling).
Implementations§
Source§impl SentenceTransformerProvider
impl SentenceTransformerProvider
Sourcepub const DEFAULT_MAX_TOKENS: usize = 512
pub const DEFAULT_MAX_TOKENS: usize = 512
Default max tokens for documentation (longer context than code).
Sourcepub fn with_config(
model_path: impl Into<PathBuf>,
max_tokens: usize,
split_sentences: bool,
) -> Self
pub fn with_config( model_path: impl Into<PathBuf>, max_tokens: usize, split_sentences: bool, ) -> Self
Create with custom max tokens and optional sentence splitting.
Sourcepub fn split_sentences(&self) -> bool
pub fn split_sentences(&self) -> bool
Whether sentence splitting is enabled.
Sourcepub fn max_tokens(&self) -> usize
pub fn max_tokens(&self) -> usize
Max token length.
Trait Implementations§
Source§impl EmbeddingProvider for SentenceTransformerProvider
impl EmbeddingProvider for SentenceTransformerProvider
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a single text chunk into a vector.
Source§fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed a batch of text chunks. Read more
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Dimensionality of the output vectors.
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Name of the embedding model (for metadata tracking).
Auto Trait Implementations§
impl Freeze for SentenceTransformerProvider
impl RefUnwindSafe for SentenceTransformerProvider
impl Send for SentenceTransformerProvider
impl Sync for SentenceTransformerProvider
impl Unpin for SentenceTransformerProvider
impl UnsafeUnpin for SentenceTransformerProvider
impl UnwindSafe for SentenceTransformerProvider
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