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
| Name | Type | Description |
|---|---|---|
top_k | usize | Maximum number of chunks to retrieve |
score_threshold | f32 | Minimum relevance score threshold |
max_context_tokens | usize | Maximum context tokens |
strategy | RetrievalStrategy | Retrieval strategy |
citations_mode | CitationsMode | Citations mode |
rerank | bool | Enable reranking |
compress | bool | Enable context compression |
chunk_overlap | usize | Chunk overlap for splitting |
chunk_size | usize | Chunk size for splitting |
Methods
new
fn new() -> SelfCreate a new RAGConfig
top_k
fn top_k(mut self, k: usize) -> SelfSet top_k
Parameters:
| Name | Type |
|---|---|
k | usize |
score_threshold
fn score_threshold(mut self, threshold: f32) -> SelfSet score threshold
Parameters:
| Name | Type |
|---|---|
threshold | f32 |
max_context_tokens
fn max_context_tokens(mut self, tokens: usize) -> SelfSet max context tokens
Parameters:
| Name | Type |
|---|---|
tokens | usize |
strategy
fn strategy(mut self, strategy: RetrievalStrategy) -> SelfSet retrieval strategy
Parameters:
| Name | Type |
|---|---|
strategy | RetrievalStrategy |
citations_mode
fn citations_mode(mut self, mode: CitationsMode) -> SelfSet citations mode
Parameters:
| Name | Type |
|---|---|
mode | CitationsMode |
rerank
fn rerank(mut self, enable: bool) -> SelfEnable reranking
Parameters:
| Name | Type |
|---|---|
enable | bool |
compress
fn compress(mut self, enable: bool) -> SelfEnable compression
Parameters:
| Name | Type |
|---|---|
enable | bool |
Source
View on GitHubpraisonai/src/rag/mod.rs at line 210