Local RAG Implementation & Architecture
Ground open-source models with your private files. FineTuneMyAI runs on-device vector indexing and semantic retrieval without sending document tokens to external vector SaaS providers.
Local Index Storage
Vector indexes are compiled into self-contained JSON data structures stored directly in ./data/rag/indexes/. Each chunk records:
- `id`: Unique chunk hash (e.g. `chunk_c77a11_0`)
- `text`: Raw snippet text extracted from the source document
- `vector`: 384-dimensional normalized float embedding vector
- `metadata`: Source filename, character offsets, and document title
Dual-Stage Retrieval Pipeline
Vector distance alone is prone to false positives on short technical entities. FineTuneMyAI separates retrieval into two distinct phases:
Scans all indexed chunk vectors against the query embedding using dot-product cosine similarity. Collects the top candidate set (default: candidate_k = 20).
Evaluates candidates using exact token density, title keyword matches, and term frequency. Selects the final highest-precision passages (default: rerank_k = 3).
Programmatic Querying via REST API
Query your local index directly via HTTP: