Vector Store Protocol • Rust AI Agent SDK
VectorStoreProtocol: Protocol for vector store implementations.
VectorStoreProtocol
Defined in the knowledge module.
Rust AI Agent SDK
Protocol for vector store implementations.
Methods
add
async fn add(&mut self, record: VectorRecord) -> Result<String>Add a record to the store
Parameters:
| Name | Type |
|---|---|
record | VectorRecord |
search
async fn search(&self, query_embedding: &[f32], limit: usize) -> Result<Vec<SearchResultItem>>Search for similar records
Parameters:
| Name | Type |
|---|---|
query_embedding | &[f32] |
limit | usize |
get
async fn get(&self, id: &str) -> Result<Option<VectorRecord>>Get a record by ID
Parameters:
| Name | Type |
|---|---|
id | &str |
delete
async fn delete(&mut self, id: &str) -> Result<bool>Delete a record by ID
Parameters:
| Name | Type |
|---|---|
id | &str |
get_all
async fn get_all(&self, limit: usize) -> Result<Vec<VectorRecord>>Get all records
Parameters:
| Name | Type |
|---|---|
limit | usize |
clear
async fn clear(&mut self) -> Result<()>Clear all records
len
fn len(&self) -> usizeGet record count
is_empty
fn is_empty(&self) -> boolCheck if empty
Source
View on GitHubpraisonai/src/knowledge/mod.rs at line 0