pub struct AstEmbeddingProvider { /* private fields */ }Expand description
AST-aware embedding provider for Rust source code.
Combines structural features (signature, types, visibility) with semantic text embeddings for hybrid code understanding.
Implementations§
Source§impl AstEmbeddingProvider
impl AstEmbeddingProvider
Sourcepub const DEFAULT_TOTAL_DIMS: usize = 256
pub const DEFAULT_TOTAL_DIMS: usize = 256
Default total output dimensionality.
Sourcepub const DEFAULT_STRUCTURAL_DIMS: usize = 64
pub const DEFAULT_STRUCTURAL_DIMS: usize = 64
Default structural feature dimensions.
Sourcepub const DEFAULT_STRUCTURAL_WEIGHT: f32 = 0.3
pub const DEFAULT_STRUCTURAL_WEIGHT: f32 = 0.3
Default weight for structural features.
Sourcepub fn new(model_path: impl Into<PathBuf>) -> Self
pub fn new(model_path: impl Into<PathBuf>) -> Self
Create a new AST-aware provider with default configuration.
Sourcepub fn with_config(
model_path: impl Into<PathBuf>,
total_dims: usize,
structural_dims: usize,
structural_weight: f32,
) -> Self
pub fn with_config( model_path: impl Into<PathBuf>, total_dims: usize, structural_dims: usize, structural_weight: f32, ) -> Self
Create with custom configuration.
Sourcepub fn total_dims(&self) -> usize
pub fn total_dims(&self) -> usize
Total output dimensions.
Sourcepub fn structural_weight(&self) -> f32
pub fn structural_weight(&self) -> f32
Weight applied to structural features.
Trait Implementations§
Source§impl EmbeddingProvider for AstEmbeddingProvider
impl EmbeddingProvider for AstEmbeddingProvider
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 AstEmbeddingProvider
impl RefUnwindSafe for AstEmbeddingProvider
impl Send for AstEmbeddingProvider
impl Sync for AstEmbeddingProvider
impl Unpin for AstEmbeddingProvider
impl UnsafeUnpin for AstEmbeddingProvider
impl UnwindSafe for AstEmbeddingProvider
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