RAG • Rust AI Agent SDK

RAG: Main RAG pipeline.

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

rust
fn new() -> RAGBuilder

Create a new RAG builder

query

rust
fn query(&self, _question: &str) -> Result<RAGResult>

Query the RAG pipeline (placeholder)

Parameters:

NameType
_question&str

add_source

rust
fn add_source(&mut self, source: impl Into<String>) -> ()

Add a knowledge source

Parameters:

NameType
sourceimpl Into&lt;String&gt;

build_context

rust
fn build_context(&self, chunks: &[ContextChunk]) -> String

Build context from chunks

Parameters:

NameType
chunks&[ContextChunk]

truncate_context

rust
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 475


Related Documentation