ChatVeritas is a document-grounded RAG assistant for local knowledge. It uses local retrieval over a private text corpus and only sends generation to the selected backend when needed.
The application separates retrieval and generation:
- Retrieval is always local: question embedding, FAISS search, and cross-encoder reranking.
- Generation can be:
- a local Hugging Face model with optional PEFT LoRA adapter,
- LM Studio local OpenAI-compatible generation,
- or Groq cloud generation.
- Streamlit multipage UI with Offline Chat, Cloud Chat, and Architecture pages
- Local FAISS retrieval and reranking for grounded answers
- Local model inference with optional PEFT LoRA adapters
- LM Studio local server support for OpenAI-compatible offline generation
- Groq cloud generation for lightweight production experimentation
- Fresh Load sidebar support for clearing cached models and reloading backend
- Utilities for corpus ingestion, chunk inspection, synthetic dataset creation, and QLoRA training
- Centralized settings in
configs/settings.py
git clone <repository-url>
cd ChatVeritas
python -m pip install -r requirements.txtAll runtime settings live in configs/settings.py. Use it to adjust:
- data, cache, and model paths
- local and LM Studio generation settings
- Groq model and API key settings
- retrieval, embedding, and reranking parameters
- synthetic question generation and fine-tuning settings
Use .env for secrets. Cloud Chat requires GROQ_API_KEY. LM Studio can use
an optional LMSTUDIO_API_KEY when the local server requires auth.
streamlit run app.pyThen use the sidebar to open:
- Offline Chat for Local Model or LM Studio
- Cloud Chat for Groq generation
- Architecture for the built-in architecture reference
Add UTF-8 .txt files to data/raw/ and build the vector store with:
python scripts/ingest.pyThe app uses generated artifacts from data/vectorstore/ at runtime.
Re-run ingestion only when the corpus changes.
The architecture reference file
data/raw/chatveritas_architecture.txt is part of the searchable corpus.
If you update it and want the new content to be retrievable, run
python scripts/ingest.py again.
The Streamlit pages include a sidebar Fresh Load action that clears cached
model resources and reloads the selected backend. Use it when you change the
model, adapter, LM Studio server, or local runtime state.
# Inspect indexed chunks
python scripts/print_chunks.py
# Build synthetic fine-tuning data
python scripts/prepare_finetune_dataset.py
# Validate fine-tuning dataset
python scripts/fine_tune.py --validate-only
# Train a QLoRA adapter
python scripts/fine_tune.pyChatVeritas/
|-- app.py
|-- configs/
| |-- __init__.py
| '-- settings.py
|-- core/
| |-- chatveritas.py
| |-- constants.py
| |-- exceptions.py
| |-- llm.py
| |-- logger.py
| |-- pipelines.py
| |-- prompts.py
| |-- retrieval.py
| '-- utils.py
|-- pages/
| |-- 1_Offline_Chat.py
| |-- 2_Cloud_Chat.py
| '-- 3_Architecture.py
|-- data/
| |-- raw/
| |-- vectorstore/
| |-- processed/
| '-- cache/
|-- models/
| |-- adapters/
| '-- checkpoints/
|-- scripts/
|-- tests/
'-- requirements.txt
For full architecture and design details, see ChatVeritas_ARCHITECTURE.md.
Distributed under the MIT License.