RAG & Knowledge Base¶
SalmAlm includes a zero-dependency RAG (Retrieval-Augmented Generation) system β no external vector DB, no embeddings API. Everything runs locally in SQLite.
How It Works¶
- Indexing: Files are chunked (5 lines, 2-line overlap) and tokenized with Korean jamo decomposition + English stemming
- Search: Hybrid BM25 (text weight 0.3) + TF-IDF cosine similarity (vector weight 0.7)
- Injection: Top results are prepended to the system prompt as context
What Gets Indexed¶
| Source | Auto-indexed | Tool |
|---|---|---|
Memory files (~/SalmAlm/memory/) |
β | memory_write |
| Notes | β | note |
| Saved links | β | save_link |
| Workspace files | On demand | file_index |
| Session transcripts | Optional | Config toggle |
Configuration¶
Edit ~/SalmAlm/rag.json:
{
"hybrid": {
"enabled": true,
"vectorWeight": 0.7,
"textWeight": 0.3
},
"sessionIndexing": {
"enabled": false,
"retentionDays": 30
},
"chunkSize": 5,
"chunkOverlap": 2,
"reindexInterval": 120
}
Korean Language Support¶
SalmAlm's RAG has first-class Korean support:
- Jamo decomposition β decomposes Hangul into consonants/vowels for fuzzy matching
- Korean stemming β strips common suffixes (μ/λ/μ΄/κ°/μ/λ₯Ό/μμ/μΌλ‘ etc.)
- Synonym expansion β κ²μβμ°ΎκΈ°/νμ, μ€λ₯βμλ¬/λ²κ·Έ etc.
- Stop word filtering β removes Korean particles and common English stop words
Web UI¶
Access the RAG panel at Settings β RAG & Knowledge to:
- View index statistics (document count, chunk count, last indexed)
- Trigger manual reindex
- Configure hybrid search weights
- Enable/disable session indexing
Related Tools¶
rag_searchβ Direct semantic searchmemory_write/memory_searchβ Long-term memory CRUDnoteβ Quick notes (auto-indexed)save_linkβ Save URLs with auto-fetched contentfile_indexβ Index workspace files on demand