pub struct SharedKnowledgeBase { /* private fields */ }Expand description
Shared knowledge base for cross-agent memory
Implementations§
Sourcepub fn new(storage: Arc<dyn Memory>, agent_id: String) -> Self
pub fn new(storage: Arc<dyn Memory>, agent_id: String) -> Self
Create a new shared knowledge base
Sourcepub async fn store(
&self,
key: impl Into<String>,
value: impl Into<MemoryValue>,
) -> RragResult<KnowledgeEntry>
pub async fn store( &self, key: impl Into<String>, value: impl Into<MemoryValue>, ) -> RragResult<KnowledgeEntry>
Store a knowledge entry
Store a knowledge entry with tags
Sourcepub async fn store_entry(&self, entry: KnowledgeEntry) -> RragResult<()>
pub async fn store_entry(&self, entry: KnowledgeEntry) -> RragResult<()>
Store a full knowledge entry
Sourcepub async fn get(&self, key: &str) -> RragResult<Option<KnowledgeEntry>>
pub async fn get(&self, key: &str) -> RragResult<Option<KnowledgeEntry>>
Get a knowledge entry
Sourcepub async fn get_value(&self, key: &str) -> RragResult<Option<MemoryValue>>
pub async fn get_value(&self, key: &str) -> RragResult<Option<MemoryValue>>
Get just the value (without metadata)
Sourcepub async fn delete(&self, key: &str) -> RragResult<bool>
pub async fn delete(&self, key: &str) -> RragResult<bool>
Delete a knowledge entry
Sourcepub async fn exists(&self, key: &str) -> RragResult<bool>
pub async fn exists(&self, key: &str) -> RragResult<bool>
Check if a key exists and is accessible
Sourcepub async fn find_by_tag(&self, tag: &str) -> RragResult<Vec<KnowledgeEntry>>
pub async fn find_by_tag(&self, tag: &str) -> RragResult<Vec<KnowledgeEntry>>
Find entries by tag
Sourcepub async fn find_by_creator(
&self,
creator_agent_id: &str,
) -> RragResult<Vec<KnowledgeEntry>>
pub async fn find_by_creator( &self, creator_agent_id: &str, ) -> RragResult<Vec<KnowledgeEntry>>
Find entries created by a specific agent
Sourcepub async fn get_all_entries(&self) -> RragResult<Vec<KnowledgeEntry>>
pub async fn get_all_entries(&self) -> RragResult<Vec<KnowledgeEntry>>
Get all accessible entries
Sourcepub async fn count(&self) -> RragResult<usize>
pub async fn count(&self) -> RragResult<usize>
Count accessible entries
Sourcepub async fn clear(&self) -> RragResult<()>
pub async fn clear(&self) -> RragResult<()>
Clear all entries (requires appropriate permissions)
Auto Trait Implementations§
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