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

# Citation • Rust AI Agent SDK

> Citation: A citation referencing a source document.

# Citation

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

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

A citation referencing a source document.

## Fields

| Name       | Type                | Description                  |
| ---------- | ------------------- | ---------------------------- |
| `id`       | `String`            | Citation ID (e.g., "\[1]")   |
| `source`   | `String`            | Source document or URL       |
| `text`     | `String`            | Relevant text snippet        |
| `page`     | `Option&lt;u32&gt;` | Page number if applicable    |
| `score`    | `Option&lt;f32&gt;` | Relevance score (0.0 to 1.0) |
| `metadata` | `HashMap&lt;String` | Additional metadata          |

## Methods

### `new`

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

Create a new citation

**Parameters:**

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

### `page`

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

Set the page number

**Parameters:**

| Name   | Type  |
| ------ | ----- |
| `page` | `u32` |

### `score`

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

Set the relevance score

**Parameters:**

| Name    | Type  |
| ------- | ----- |
| `score` | `f32` |

### `metadata`

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

Add metadata

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `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/rag/mod.rs#L34">
  `praisonai/src/rag/mod.rs` at line 34
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Citations" icon="quote-left" href="/docs/rust/citations" />
</CardGroup>
