pub struct SemanticMemory { /* private fields */ }Expand description
Semantic memory for managing facts and knowledge
Implementations§
Source§impl SemanticMemory
impl SemanticMemory
pub fn new() -> Self
Sourcepub async fn add_entity(
&self,
name: String,
entity_type: EntityType,
memory_id: String,
) -> String
pub async fn add_entity( &self, name: String, entity_type: EntityType, memory_id: String, ) -> String
Add or update an entity
Sourcepub async fn get_entity(&self, id: &str) -> Option<Entity>
pub async fn get_entity(&self, id: &str) -> Option<Entity>
Get an entity by ID
Sourcepub async fn get_entity_by_name(&self, name: &str) -> Option<Entity>
pub async fn get_entity_by_name(&self, name: &str) -> Option<Entity>
Get an entity by name
Sourcepub async fn get_entities_by_type(&self, entity_type: EntityType) -> Vec<Entity>
pub async fn get_entities_by_type(&self, entity_type: EntityType) -> Vec<Entity>
Get all entities of a specific type
Sourcepub async fn search_entities(&self, query: &str) -> Vec<Entity>
pub async fn search_entities(&self, query: &str) -> Vec<Entity>
Search entities by name (partial match)
Sourcepub async fn add_fact(
&self,
subject: String,
predicate: String,
object: String,
memory_id: String,
) -> String
pub async fn add_fact( &self, subject: String, predicate: String, object: String, memory_id: String, ) -> String
Add or confirm a fact
Sourcepub async fn get_facts_about(&self, subject: &str) -> Vec<Fact>
pub async fn get_facts_about(&self, subject: &str) -> Vec<Fact>
Get all facts about a subject
Sourcepub async fn get_facts_by_predicate(&self, predicate: &str) -> Vec<Fact>
pub async fn get_facts_by_predicate(&self, predicate: &str) -> Vec<Fact>
Get all facts with a specific predicate
Sourcepub async fn get_high_confidence_facts(&self, threshold: f32) -> Vec<Fact>
pub async fn get_high_confidence_facts(&self, threshold: f32) -> Vec<Fact>
Get high-confidence facts (confidence >= threshold)
Sourcepub async fn add_relationship(
&self,
from_entity: String,
to_entity: String,
relationship_type: String,
) -> String
pub async fn add_relationship( &self, from_entity: String, to_entity: String, relationship_type: String, ) -> String
Add a relationship between entities
Sourcepub async fn get_relationships(&self, entity_id: &str) -> Vec<Relationship>
pub async fn get_relationships(&self, entity_id: &str) -> Vec<Relationship>
Get relationships for an entity
Sourcepub async fn get_knowledge_summary(
&self,
entity_name: &str,
) -> Option<KnowledgeSummary>
pub async fn get_knowledge_summary( &self, entity_name: &str, ) -> Option<KnowledgeSummary>
Get a knowledge summary for an entity
Sourcepub async fn get_all_entity_names(&self) -> Vec<String>
pub async fn get_all_entity_names(&self) -> Vec<String>
Get all entity names
Sourcepub async fn get_statistics(&self) -> SemanticMemoryStats
pub async fn get_statistics(&self) -> SemanticMemoryStats
Get statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SemanticMemory
impl !RefUnwindSafe for SemanticMemory
impl Send for SemanticMemory
impl Sync for SemanticMemory
impl Unpin for SemanticMemory
impl !UnwindSafe for SemanticMemory
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