๐ Vector DB Document Retrieval
SLM RAG
Local Retrieval-Augmented Generation engine for offline document indexing, dense vector search, and grounded Q&A.
๐ Overview & Capabilities
Local Retrieval-Augmented Generation engine for offline document indexing, dense vector search, and grounded Q&A.
Key Features
- Offline ONNX embedding generation
- Local vector similarity indexing
- Grounded factual document question answering
- Strict context window enforcement
๐ป Installation
Install the local package using pip:
๐ Checkout from GitHub
Clone only this agent's folder from the monorepo using Git sparse-checkout โ no need to download the full repository:
Option 1 โ Sparse Checkout (Recommended)
Option 2 โ Full Repository Clone
๐ก Tip: After checkout, install the package locally with pip install -e ./slm_rag to run in editable mode without publishing to PyPI.
โ๏ธ Configuration API
Constructor Parameters
Instantiate SLMRag with performance and runtime options:
| Parameter | Type / Default | Description |
|---|---|---|
model_path | str | None | Local ONNX model path. Default: None. |
temperature | float | 0.0 | Sampling temperature. Default: 0.0. |
top_p | float | 0.9 | Nucleus sampling threshold. Default: 0.9. |
max_tokens | int | 256 | Maximum output token limit. Default: 256. |
n_threads | int | 4 | CPU threads. Default: 4. |
Methods
| Method Signature | Return Type | Description |
|---|---|---|
answer(question, chunks, ...) | str | dict | Retrieves matching context chunks and generates factual response. |
Execution Parameters
Complete list of execution parameters accepted by the primary agent method:
| Parameter | Type / Default | Description |
|---|---|---|
question | str | User question string. |
chunks | list[str] | str | Document context text or chunk list. |
instruction | str | None | Extraction instruction guideline. Default: None. |
system_prompt | str | None | System prompt instruction. Default: None. |
user_input | str | None | Contextual key values. Default: None. |
temperature | float | 0.0 | Sampling temperature. Default: 0.0. |
top_p | float | 0.9 | Nucleus sampling probability. Default: 0.9. |
max_tokens | int | 256 | Maximum token limit. Default: 256. |
Quick Start
๐ Verified Output Logs
Diagnostic execution console output running locally on CPU: