pub struct EmbeddingGenerator {
pub skip_existing: bool,
/* private fields */
}Expand description
Embedding generator using sentence-transformers.
Fields§
§skip_existing: boolIf true, skip entities that already have real (non-zero) embeddings.
Implementations§
Source§impl EmbeddingGenerator
impl EmbeddingGenerator
Sourcepub fn with_config(config: EmbeddingConfig) -> Self
pub fn with_config(config: EmbeddingConfig) -> Self
Create a new embedding generator with custom configuration.
Sourcepub fn with_force(self, force: bool) -> Self
pub fn with_force(self, force: bool) -> Self
Set force mode: if true, regenerate embeddings even for entities that already have real (non-zero) vectors.
Sourcepub fn generate_embeddings(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>>
pub fn generate_embeddings(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>>
Generate embeddings for a list of texts.
Sourcepub fn generate_for_papers(&self, conn: &Connection) -> Result<EmbeddingStats>
pub fn generate_for_papers(&self, conn: &Connection) -> Result<EmbeddingStats>
Generate embeddings for all paper entities in the database.
Sourcepub fn generate_for_skills(&self, conn: &Connection) -> Result<EmbeddingStats>
pub fn generate_for_skills(&self, conn: &Connection) -> Result<EmbeddingStats>
Generate embeddings for all skill entities in the database.
Sourcepub fn generate_for_all(&self, conn: &Connection) -> Result<EmbeddingStats>
pub fn generate_for_all(&self, conn: &Connection) -> Result<EmbeddingStats>
Generate embeddings for all entities in the database.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddingGenerator
impl RefUnwindSafe for EmbeddingGenerator
impl Send for EmbeddingGenerator
impl Sync for EmbeddingGenerator
impl Unpin for EmbeddingGenerator
impl UnsafeUnpin for EmbeddingGenerator
impl UnwindSafe for EmbeddingGenerator
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.