> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vector Store Protocol • Rust AI Agent SDK

> VectorStoreProtocol: Protocol for vector store implementations.

# VectorStoreProtocol

> Defined in the [**knowledge**](../modules/knowledge) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Protocol for vector store implementations.

## Methods

### `add`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn add(&mut self, record: VectorRecord) -> Result<String>
```

Add a record to the store

**Parameters:**

| Name     | Type           |
| -------- | -------------- |
| `record` | `VectorRecord` |

### `search`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn get(&self, id: &str) -> Result<Option<VectorRecord>>
```

Get a record by ID

**Parameters:**

| Name | Type   |
| ---- | ------ |
| `id` | `&str` |

### `delete`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn delete(&mut self, id: &str) -> Result<bool>
```

Delete a record by ID

**Parameters:**

| Name | Type   |
| ---- | ------ |
| `id` | `&str` |

### `get_all`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn get_all(&self, limit: usize) -> Result<Vec<VectorRecord>>
```

Get all records

**Parameters:**

| Name    | Type    |
| ------- | ------- |
| `limit` | `usize` |

### `clear`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn clear(&mut self) -> Result<()>
```

Clear all records

### `len`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn len(&self) -> usize
```

Get record count

### `is_empty`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_empty(&self) -> bool
```

Check if empty

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/knowledge/mod.rs">
  `praisonai/src/knowledge/mod.rs` at line 0
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Vector Store" icon="database" href="/docs/rust/vector-store" />

  <Card title="Rust Embeddings" icon="code" href="/docs/rust/embeddings" />
</CardGroup>
