pub trait EmbeddingModel: Send + Sync {
Show 19 methods
// Required methods
fn config(&self) -> &ModelConfig;
fn model_id(&self) -> &Uuid;
fn model_type(&self) -> &'static str;
fn add_triple(&mut self, triple: Triple) -> Result<()>;
fn train<'life0, 'async_trait>(
&'life0 mut self,
epochs: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<TrainingStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_entity_embedding(&self, entity: &str) -> Result<Vector>;
fn get_relation_embedding(&self, relation: &str) -> Result<Vector>;
fn score_triple(
&self,
subject: &str,
predicate: &str,
object: &str,
) -> Result<f64>;
fn predict_objects(
&self,
subject: &str,
predicate: &str,
k: usize,
) -> Result<Vec<(String, f64)>>;
fn predict_subjects(
&self,
predicate: &str,
object: &str,
k: usize,
) -> Result<Vec<(String, f64)>>;
fn predict_relations(
&self,
subject: &str,
object: &str,
k: usize,
) -> Result<Vec<(String, f64)>>;
fn get_entities(&self) -> Vec<String>;
fn get_relations(&self) -> Vec<String>;
fn get_stats(&self) -> ModelStats;
fn save(&self, path: &str) -> Result<()>;
fn load(&mut self, path: &str) -> Result<()>;
fn clear(&mut self);
fn is_trained(&self) -> bool;
fn encode<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Basic embedding model trait