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

# Document • Rust AI Agent SDK

> Document: A document in the knowledge base.

# Document

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

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

A document in the knowledge base.

## Fields

| Name         | Type                   | Description           |
| ------------ | ---------------------- | --------------------- |
| `id`         | `String`               | Document ID           |
| `content`    | `String`               | Document content      |
| `metadata`   | `HashMap&lt;String`    | Document metadata     |
| `source`     | `Option&lt;String&gt;` | Source path or URL    |
| `filename`   | `Option&lt;String&gt;` | Filename if from file |
| `created_at` | `Option&lt;u64&gt;`    | Creation timestamp    |
| `updated_at` | `Option&lt;u64&gt;`    | Update timestamp      |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new(content: impl Into<String>) -> Self
```

Create a new document

**Parameters:**

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

### `metadata`

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

Set metadata

**Parameters:**

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

### `source`

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

Set source

**Parameters:**

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

### `filename`

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

Set filename

**Parameters:**

| Name       | Type                      |
| ---------- | ------------------------- |
| `filename` | `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#L36">
  `praisonai/src/knowledge/mod.rs` at line 36
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Documents" icon="file-lines" href="/docs/rust/documents" />

  <Card title="Rust Files" icon="file" href="/docs/rust/files" />

  <Card title="Rust OCR" icon="file-image" href="/docs/rust/ocr" />
</CardGroup>
