Quick Start
How It Works
Knowledge Methods
| Method | Signature | Description |
|---|---|---|
add(content, metadata) | fn add(&mut self, &str, Option<HashMap>) -> Result<AddResult> | Add text content |
add_document(doc) | fn add_document(&mut self, Document) -> Result<AddResult> | Add a document |
search(query, limit) | fn search(&self, &str, usize) -> Result<SearchResult> | Search knowledge |
get(id) | fn get(&self, &str) -> Option<&Document> | Get document by ID |
delete(id) | fn delete(&mut self, &str) -> bool | Delete document |
clear() | fn clear(&mut self) | Clear all documents |
len() | fn len(&self) -> usize | Document count |
chunk(text) | fn chunk(&self, &str) -> Vec<String> | Chunk text |
KnowledgeBuilder Methods
| Method | Signature | Description |
|---|---|---|
config(cfg) | fn config(KnowledgeConfig) -> Self | Set full config |
chunking(cfg) | fn chunking(ChunkingConfig) -> Self | Set chunking config |
retrieval_strategy(s) | fn retrieval_strategy(RetrievalStrategy) -> Self | Set retrieval |
build() | fn build(self) -> Result<Knowledge> | Build instance |
Best Practices
Use specific file types
Use specific file types
PDF, TXT, and MD files work best. Keep documents focused and organized.
Chunk size matters
Chunk size matters
Smaller chunks (500-1000) for specific answers, larger for context.
Update knowledge regularly
Update knowledge regularly
Rebuild knowledge base when documents change.

