Retrieval Result • Rust AI Agent SDK
RetrievalResult: Result of a retrieval operation.
RetrievalResult
Defined in the RAG module.
Rust AI Agent SDK
Result of a retrieval operation.
Fields
| Name | Type | Description |
|---|---|---|
chunks | Vec<ContextChunk> | Retrieved chunks |
query | String | Query used |
strategy | RetrievalStrategy | Strategy used |
total_searched | usize | Total documents searched |
Methods
new
fn new(query: impl Into<String>, strategy: RetrievalStrategy) -> SelfCreate a new retrieval result
Parameters:
| Name | Type |
|---|---|
query | impl Into<String> |
strategy | RetrievalStrategy |
add_chunk
fn add_chunk(&mut self, chunk: ContextChunk) -> ()Add a chunk
Parameters:
| Name | Type |
|---|---|
chunk | ContextChunk |
top_chunks
fn top_chunks(&self, n: usize) -> Vec<&ContextChunk>Get top chunks by score
Parameters:
| Name | Type |
|---|---|
n | usize |
Source
View on GitHubpraisonai/src/rag/mod.rs at line 434