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

NameTypeDescription
chunksVec<ContextChunk>Retrieved chunks
queryStringQuery used
strategyRetrievalStrategyStrategy used
total_searchedusizeTotal documents searched

Methods

new

rust
fn new(query: impl Into<String>, strategy: RetrievalStrategy) -> Self

Create a new retrieval result

Parameters:

NameType
queryimpl Into&lt;String&gt;
strategyRetrievalStrategy

add_chunk

rust
fn add_chunk(&mut self, chunk: ContextChunk) -> ()

Add a chunk

Parameters:

NameType
chunkContextChunk

top_chunks

rust
fn top_chunks(&self, n: usize) -> Vec<&ContextChunk>

Get top chunks by score

Parameters:

NameType
nusize

Source

View on GitHub

praisonai/src/rag/mod.rs at line 434


Related Documentation