RAG • Rust AI Agent SDK
RAG: Main RAG pipeline.
RAG
Defined in the RAG module.
Rust AI Agent SDK
Main RAG pipeline.
Fields
| Name | Type | Description |
|---|---|---|
config | RAGConfig | Configuration |
model | String | LLM model for generation |
sources | Vec<String> | Knowledge sources |
Methods
new
fn new() -> RAGBuilderCreate a new RAG builder
query
fn query(&self, _question: &str) -> Result<RAGResult>Query the RAG pipeline (placeholder)
Parameters:
| Name | Type |
|---|---|
_question | &str |
add_source
fn add_source(&mut self, source: impl Into<String>) -> ()Add a knowledge source
Parameters:
| Name | Type |
|---|---|
source | impl Into<String> |
build_context
fn build_context(&self, chunks: &[ContextChunk]) -> StringBuild context from chunks
Parameters:
| Name | Type |
|---|---|
chunks | &[ContextChunk] |
truncate_context
fn truncate_context(&self, context: &str, max_tokens: usize) -> StringTruncate context to fit token budget
Parameters:
| Name | Type |
|---|---|
context | &str |
max_tokens | usize |
Source
View on GitHubpraisonai/src/rag/mod.rs at line 475