Skip to main content

RAG

Defined in the RAG module.
Rust AI Agent SDK Main RAG pipeline.

Fields

NameTypeDescription
configRAGConfigConfiguration
modelStringLLM model for generation
sourcesVec<String>Knowledge sources

Methods

new

fn new() -> RAGBuilder
Create a new RAG builder

query

fn query(&self, question: &str) -> Result<RAGResult>
Query the RAG pipeline (placeholder) Parameters:
NameType
question&str

add_source

fn add_source(&mut self, source: impl Into<String>) -> ()
Add a knowledge source Parameters:
NameType
sourceimpl Into&lt;String&gt;

build_context

fn build_context(&self, chunks: &[ContextChunk]) -> String
Build context from chunks Parameters:
NameType
chunks&[ContextChunk]

truncate_context

fn truncate_context(&self, context: &str, max_tokens: usize) -> String
Truncate context to fit token budget Parameters:
NameType
context&str
max_tokensusize

Source

View on GitHub

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