Skip to main content

RAGConfig

Defined in the RAG module.
Rust AI Agent SDK Configuration for RAG pipeline.

Fields

NameTypeDescription
top_kusizeMaximum number of chunks to retrieve
score_thresholdf32Minimum relevance score threshold
max_context_tokensusizeMaximum context tokens
strategyRetrievalStrategyRetrieval strategy
citations_modeCitationsModeCitations mode
rerankboolEnable reranking
compressboolEnable context compression
chunk_overlapusizeChunk overlap for splitting
chunk_sizeusizeChunk size for splitting

Methods

new

fn new() -> Self
Create a new RAGConfig

top_k

fn top_k(mut self, k: usize) -> Self
Set top_k Parameters:
NameType
kusize

score_threshold

fn score_threshold(mut self, threshold: f32) -> Self
Set score threshold Parameters:
NameType
thresholdf32

max_context_tokens

fn max_context_tokens(mut self, tokens: usize) -> Self
Set max context tokens Parameters:
NameType
tokensusize

strategy

fn strategy(mut self, strategy: RetrievalStrategy) -> Self
Set retrieval strategy Parameters:
NameType
strategyRetrievalStrategy

citations_mode

fn citations_mode(mut self, mode: CitationsMode) -> Self
Set citations mode Parameters:
NameType
modeCitationsMode

rerank

fn rerank(mut self, enable: bool) -> Self
Enable reranking Parameters:
NameType
enablebool

compress

fn compress(mut self, enable: bool) -> Self
Enable compression Parameters:
NameType
enablebool

Source

View on GitHub

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