pub struct EmbeddingEngine { /* private fields */ }Implementations§
Source§impl EmbeddingEngine
impl EmbeddingEngine
Sourcepub fn load(model_dir: &Path) -> Result<Self>
pub fn load(model_dir: &Path) -> Result<Self>
Load embedding model and vocabulary from a directory. Downloads model automatically from HuggingFace if not present.
Expected files (auto-downloaded):
model.onnx— all-MiniLM-L6-v2 ONNX embedding modelvocab.txt— WordPiece vocabulary (one token per line)
Sourcepub fn load_default() -> Result<Self>
pub fn load_default() -> Result<Self>
Load from default model directory (~/.lean-ctx/models/).
Sourcepub fn embed(&self, text: &str) -> Result<Vec<f32>>
pub fn embed(&self, text: &str) -> Result<Vec<f32>>
Generate an embedding vector for a single text.
Sourcepub fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
pub fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
Generate embedding vectors for multiple texts.
pub fn dimensions(&self) -> usize
Sourcepub fn model_directory() -> PathBuf
pub fn model_directory() -> PathBuf
Resolve the model directory (respects LEAN_CTX_MODELS_DIR env).
Sourcepub fn is_available() -> bool
pub fn is_available() -> bool
Check if the model files are present and loadable.
Auto Trait Implementations§
impl Freeze for EmbeddingEngine
impl !RefUnwindSafe for EmbeddingEngine
impl Send for EmbeddingEngine
impl Sync for EmbeddingEngine
impl Unpin for EmbeddingEngine
impl UnsafeUnpin for EmbeddingEngine
impl !UnwindSafe for EmbeddingEngine
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