pub struct EmbeddingService { /* private fields */ }Implementations§
Source§impl EmbeddingService
impl EmbeddingService
pub fn new_ollama(url: String, model: String, db_path: PathBuf) -> Self
pub async fn init_db(&self) -> Result<(), EmbeddingError>
pub async fn embed_text(&self, text: &str) -> Result<Vec<f32>, EmbeddingError>
pub async fn embed_skill( &self, skill: &Skill, ) -> Result<Vec<f32>, EmbeddingError>
pub async fn store_embedding( &self, skill_id: &str, embedding: &[f32], ) -> Result<(), EmbeddingError>
pub async fn get_embedding( &self, skill_id: &str, ) -> Result<Option<Vec<f32>>, EmbeddingError>
pub async fn index_skill(&self, skill: &Skill) -> Result<(), EmbeddingError>
pub async fn cosine_similarity(&self, a: &[f32], b: &[f32]) -> f64
pub async fn search_similar( &self, query_embedding: &[f32], skill_ids: &[String], limit: usize, ) -> Result<Vec<(String, f64)>, EmbeddingError>
Trait Implementations§
Source§impl Clone for EmbeddingService
impl Clone for EmbeddingService
Source§fn clone(&self) -> EmbeddingService
fn clone(&self) -> EmbeddingService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EmbeddingService
impl RefUnwindSafe for EmbeddingService
impl Send for EmbeddingService
impl Sync for EmbeddingService
impl Unpin for EmbeddingService
impl UnsafeUnpin for EmbeddingService
impl UnwindSafe for EmbeddingService
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