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
async fn search(
&self,
query: &str,
user_id: Option<&str>,
agent_id: Option<&str>,
limit: usize,
) -> Result<SearchResult>Search for relevant content
Parameters:
| Name | Type |
|---|---|
query | &str |
user_id | Option<&str> |
agent_id | Option<&str> |
limit | usize |
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:
| Name | Type |
|---|---|
content | &str |
user_id | Option<&str> |
agent_id | Option<&str> |
metadata | Option<HashMap<String |
get
async fn get(&self, item_id: &str) -> Result<Option<SearchResultItem>>Get item by ID
Parameters:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
user_id | Option<&str> |
agent_id | Option<&str> |
limit | usize |
update
async fn update(&mut self, item_id: &str, content: &str) -> Result<AddResult>Update an item
Parameters:
| Name | Type |
|---|---|
item_id | &str |
content | &str |
delete
async fn delete(&mut self, item_id: &str) -> Result<bool>Delete an item
Parameters:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
user_id | Option<&str> |
agent_id | Option<&str> |
Source
View on GitHubpraisonai/src/knowledge/mod.rs at line 0