Skip to main content

KnowledgeStoreProtocol

Defined in the knowledge module.
Rust AI Agent SDK Protocol for knowledge store backends.

Methods

async fn search(
        &self,
        query: &str,
        user_id: Option<&str>,
        agent_id: Option<&str>,
        limit: usize,
    ) -> Result<SearchResult>
Search for relevant content Parameters:
NameType
query&str
user_idOption&lt;&str&gt;
agent_idOption&lt;&str&gt;
limitusize

add

async fn add(
        &mut self,
        content: &str,
        user_id: Option<&str>,
        agent_id: Option<&str>,
        metadata: Option<HashMap<String, String>>,
    ) -> Result<AddResult>
Add content to the store Parameters:
NameType
content&str
user_idOption&lt;&str&gt;
agent_idOption&lt;&str&gt;
metadataOption&lt;HashMap&lt;String

get

async fn get(&self, item_id: &str) -> Result<Option<SearchResultItem>>
Get item by ID Parameters:
NameType
item_id&str

get_all

async fn get_all(
        &self,
        user_id: Option<&str>,
        agent_id: Option<&str>,
        limit: usize,
    ) -> Result<SearchResult>
Get all items Parameters:
NameType
user_idOption&lt;&str&gt;
agent_idOption&lt;&str&gt;
limitusize

update

async fn update(&mut self, item_id: &str, content: &str) -> Result<AddResult>
Update an item Parameters:
NameType
item_id&str
content&str

delete

async fn delete(&mut self, item_id: &str) -> Result<bool>
Delete an item Parameters:
NameType
item_id&str

delete_all

async fn delete_all(&mut self, user_id: Option<&str>, agent_id: Option<&str>) -> Result<bool>
Delete all items Parameters:
NameType
user_idOption&lt;&str&gt;
agent_idOption&lt;&str&gt;

Source

View on GitHub

praisonai/src/knowledge/mod.rs at line 0