Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Knowledge
Defined in the knowledge module.
Rust AI Agent SDK
Main knowledge manager.
Fields
| Name | Type | Description |
|---|
config | KnowledgeConfig | Configuration |
documents | Vec<Document> | Documents |
chunking | Chunking | Chunking utility |
Methods
new
fn new() -> KnowledgeBuilder
Create a new knowledge builder
add
fn add(&mut self, content: &str, metadata: Option<HashMap<String, String>>) -> Result<AddResult>
Add content to knowledge base
Parameters:
| Name | Type |
|---|
content | &str |
metadata | Option<HashMap<String |
add_document
fn add_document(&mut self, document: Document) -> Result<AddResult>
Add a document
Parameters:
search
fn search(&self, query: &str, limit: usize) -> Result<SearchResult>
Search knowledge base (placeholder - would use embeddings in real impl)
Parameters:
| Name | Type |
|---|
query | &str |
limit | usize |
get
fn get(&self, id: &str) -> Option<&Document>
Get document by ID
Parameters:
delete
fn delete(&mut self, id: &str) -> bool
Delete document by ID
Parameters:
clear
fn clear(&mut self) -> ()
Clear all documents
len
Get document count
is_empty
fn is_empty(&self) -> bool
Check if empty
chunk
fn chunk(&self, text: &str) -> Vec<String>
Chunk text using configured strategy
Parameters:
Source
View on GitHub
praisonai/src/knowledge/mod.rs at line 756