Files
kb/engine/kb/config.py
T
steve 9aab79d49b v2 restructure: Go client, Docker engine, release tooling
- Remove v1 Python CLI (src/kb_search/, tests/, root pyproject.toml, uv.lock, .venv)
- Add Go client with cross-platform build (client/)
- Add FastAPI engine with NVIDIA and multi-stage ROCm Dockerfiles (engine/)
- Add VERSION files for client and engine, wired into builds
- Add release.sh for automated build, tag, release, and Docker push
- Update README with build/release docs and ROCm migration note
- Clean up .gitignore for v2 project structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 21:52:25 +00:00

45 lines
1.2 KiB
Python

"""Engine configuration — all settings from environment variables."""
import os
from pathlib import Path
class Config:
data_dir: Path
model: str
device: str
ingest_device: str
api_key: str | None
host: str
port: int
def __init__(self):
self.data_dir = Path(os.environ.get("KB_DATA_DIR", "/data"))
self.model = os.environ.get("KB_MODEL", "all-MiniLM-L6-v2")
self.device = os.environ.get("KB_DEVICE", "auto")
self.ingest_device = os.environ.get("KB_INGEST_DEVICE", "auto")
self.api_key = os.environ.get("KB_API_KEY") or None
self.search_threshold = float(os.environ.get("KB_SEARCH_THRESHOLD", "0.01"))
self.host = os.environ.get("KB_HOST", "0.0.0.0")
self.port = int(os.environ.get("KB_PORT", "8000"))
@property
def db_path(self) -> Path:
return self.data_dir / "kb.db"
@property
def hf_cache(self) -> Path:
return self.data_dir / "hf_cache"
@property
def staging_dir(self) -> Path:
return self.data_dir / "staging"
def ensure_dirs(self):
self.data_dir.mkdir(parents=True, exist_ok=True)
self.hf_cache.mkdir(exist_ok=True)
self.staging_dir.mkdir(exist_ok=True)
cfg = Config()