> ## 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.

# Knowledge Config • Rust AI Agent SDK

> KnowledgeConfig: Knowledge configuration.

# KnowledgeConfig

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

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

Knowledge configuration.

## Fields

| Name                 | Type                   | Description            |
| -------------------- | ---------------------- | ---------------------- |
| `chunking`           | `ChunkingConfig`       | Chunking configuration |
| `retrieval_strategy` | `RetrievalStrategy`    | Retrieval strategy     |
| `default_limit`      | `usize`                | Default search limit   |
| `enable_reranking`   | `bool`                 | Enable reranking       |
| `user_id`            | `Option&lt;String&gt;` | User ID for scoping    |
| `agent_id`           | `Option&lt;String&gt;` | Agent ID for scoping   |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new() -> Self
```

Create a new config

### `chunking`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn chunking(mut self, config: ChunkingConfig) -> Self
```

Set chunking config

**Parameters:**

| Name     | Type             |
| -------- | ---------------- |
| `config` | `ChunkingConfig` |

### `retrieval_strategy`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn retrieval_strategy(mut self, strategy: RetrievalStrategy) -> Self
```

Set retrieval strategy

**Parameters:**

| Name       | Type                |
| ---------- | ------------------- |
| `strategy` | `RetrievalStrategy` |

### `default_limit`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn default_limit(mut self, limit: usize) -> Self
```

Set default limit

**Parameters:**

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

### `enable_reranking`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn enable_reranking(mut self, enable: bool) -> Self
```

Enable reranking

**Parameters:**

| Name     | Type   |
| -------- | ------ |
| `enable` | `bool` |

### `user_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn user_id(mut self, id: impl Into<String>) -> Self
```

Set user ID

**Parameters:**

| Name | Type                      |
| ---- | ------------------------- |
| `id` | `impl Into&lt;String&gt;` |

### `agent_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn agent_id(mut self, id: impl Into<String>) -> Self
```

Set agent ID

**Parameters:**

| Name | Type                      |
| ---- | ------------------------- |
| `id` | `impl Into&lt;String&gt;` |

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Knowledge" icon="book" href="/docs/rust/knowledge" />

  <Card title="Rust Documents" icon="file-lines" href="/docs/rust/documents" />

  <Card title="Rust RAG" icon="magnifying-glass" href="/docs/rust/rag" />

  <Card title="Rust Configuration" icon="gear" href="/docs/rust/configuration" />

  <Card title="Rust Installation" icon="download" href="/docs/rust/installation" />
</CardGroup>
