Skip to main content

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

fn new(query: impl Into<String>, strategy: RetrievalStrategy) -> Self
Create a new retrieval result Parameters:
NameType
queryimpl Into&lt;String&gt;
strategyRetrievalStrategy

add_chunk

fn add_chunk(&mut self, chunk: ContextChunk) -> ()
Add a chunk Parameters:
NameType
chunkContextChunk

top_chunks

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 426