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

rust
async fn add(&mut self, record: VectorRecord) -> Result<String>

Add a record to the store

Parameters:

NameType
recordVectorRecord

search

rust
async fn search(&self, query_embedding: &[f32], limit: usize) -> Result<Vec<SearchResultItem>>

Search for similar records

Parameters:

NameType
query_embedding&[f32]
limitusize

get

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

Get a record by ID

Parameters:

NameType
id&str

delete

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

Delete a record by ID

Parameters:

NameType
id&str

get_all

rust
async fn get_all(&self, limit: usize) -> Result<Vec<VectorRecord>>

Get all records

Parameters:

NameType
limitusize

clear

rust
async fn clear(&mut self) -> Result<()>

Clear all records

len

rust
fn len(&self) -> usize

Get record count

is_empty

rust
fn is_empty(&self) -> bool

Check if empty

Source

View on GitHub

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


Related Documentation