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

# Retrieval Result • Rust AI Agent SDK

> RetrievalResult: Result of a retrieval operation.

# RetrievalResult

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

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

Result of a retrieval operation.

## Fields

| Name             | Type                      | Description              |
| ---------------- | ------------------------- | ------------------------ |
| `chunks`         | `Vec&lt;ContextChunk&gt;` | Retrieved chunks         |
| `query`          | `String`                  | Query used               |
| `strategy`       | `RetrievalStrategy`       | Strategy used            |
| `total_searched` | `usize`                   | Total documents searched |

## Methods

### `new`

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

Create a new retrieval result

**Parameters:**

| Name       | Type                      |
| ---------- | ------------------------- |
| `query`    | `impl Into&lt;String&gt;` |
| `strategy` | `RetrievalStrategy`       |

### `add_chunk`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn add_chunk(&mut self, chunk: ContextChunk) -> ()
```

Add a chunk

**Parameters:**

| Name    | Type           |
| ------- | -------------- |
| `chunk` | `ContextChunk` |

### `top_chunks`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn top_chunks(&self, n: usize) -> Vec<&ContextChunk>
```

Get top chunks by score

**Parameters:**

| Name | Type    |
| ---- | ------- |
| `n`  | `usize` |

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Retrieval" icon="search" href="/docs/rust/retrieval" />

  <Card title="Rust Query" icon="magnifying-glass" href="/docs/rust/query" />

  <Card title="Rust Evaluation" icon="gavel" href="/docs/rust/evaluation" />

  <Card title="Rust Criteria" icon="check-double" href="/docs/rust/criteria" />
</CardGroup>
