Knowledge Store Protocol • Rust AI Agent SDK

KnowledgeStoreProtocol: Protocol for knowledge store backends.

KnowledgeStoreProtocol

Defined in the knowledge module.

Rust AI Agent SDK

Protocol for knowledge store backends.

Methods

search

rust
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

rust
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

rust
async fn get(&self, item_id: &str) -> Result<Option<SearchResultItem>>

Get item by ID

Parameters:

NameType
item_id&str

get_all

rust
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

rust
async fn update(&mut self, item_id: &str, content: &str) -> Result<AddResult>

Update an item

Parameters:

NameType
item_id&str
content&str

delete

rust
async fn delete(&mut self, item_id: &str) -> Result<bool>

Delete an item

Parameters:

NameType
item_id&str

delete_all

rust
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


Related Documentation