RAG Config • Rust AI Agent SDK

RAGConfig: Configuration for RAG pipeline.

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

rust
fn new() -> Self

Create a new RAGConfig

top_k

rust
fn top_k(mut self, k: usize) -> Self

Set top_k

Parameters:

NameType
kusize

score_threshold

rust
fn score_threshold(mut self, threshold: f32) -> Self

Set score threshold

Parameters:

NameType
thresholdf32

max_context_tokens

rust
fn max_context_tokens(mut self, tokens: usize) -> Self

Set max context tokens

Parameters:

NameType
tokensusize

strategy

rust
fn strategy(mut self, strategy: RetrievalStrategy) -> Self

Set retrieval strategy

Parameters:

NameType
strategyRetrievalStrategy

citations_mode

rust
fn citations_mode(mut self, mode: CitationsMode) -> Self

Set citations mode

Parameters:

NameType
modeCitationsMode

rerank

rust
fn rerank(mut self, enable: bool) -> Self

Enable reranking

Parameters:

NameType
enablebool

compress

rust
fn compress(mut self, enable: bool) -> Self

Enable compression

Parameters:

NameType
enablebool

Source

View on GitHub

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


Related Documentation