askme-public/src/askme/config.py
Lukasz Boryn 0e0bae4b9b feat: initial public release of askme
* local question answering over analysis notebooks with LightRAG, Neo4j, Qdrant and Ollama
* RAGAS evaluation with a generator x judge comparison matrix, fully local
* docs in README and OKF
2026-11-03 17:50:52 +01:00

65 lines
2.6 KiB
Python

from pydantic_settings import BaseSettings
class Settings(BaseSettings):
# Ollama
ollama_host: str = "http://localhost:11434"
# #ADJUST answer generator + graph builder — fallback for LLM_MODEL (justfile).
llm_model: str = "qwen2.5:7b"
# #ADJUST embedding type — fallback for EMBEDDING_MODEL/DIM (justfile); fixed per store.
embedding_model: str = "nomic-embed-text"
embedding_dim: int = 768 # nomic-embed-text output dimension
llm_timeout: int | None = None
# llama.cpp router (OpenAI-compatible) — optional second backend for eval
# models, addressed as "llamacpp:<model-id>"
llamacpp_url: str = "http://localhost:8080"
# Neo4j
neo4j_uri: str = "neo4j://localhost:7687"
neo4j_username: str = "neo4j"
neo4j_password: str = "askme_neo4j"
# Qdrant
qdrant_url: str = "http://localhost:6333"
# Storage
data_dir: str = "/usr/askme/data"
rag_working_dir: str = "/usr/askme/data/rag_storage"
# Ingestion
# #ADJUST chunking: smaller chunks give more precise retrieval but split context
# across pieces (more chunks needed per answer); larger ones carry more context but
# risk the 4000-char embedding cut. Overlap keeps statements spanning a border
# findable. Ingest-time: changing either needs a re-ingest.
chunk_size: int = 1200
chunk_overlap: int = 200
minhash_threshold: float = 0.95
# LightRAG runtime
# #ADJUST memory: concurrent LLM calls; above OLLAMA_NUM_PARALLEL they only queue,
# and each slot costs KV-cache VRAM. Speed only, unless it spills the model to CPU.
max_async: int = 2 # match OLLAMA_NUM_PARALLEL=2 — safe sweet spot on RTX 5060 8GB
# #ADJUST query mode: hybrid (graph neighbourhood + global summaries), local
# (entity neighbourhood), global (relation summaries), naive (plain vector search on
# chunks). Decides what text is retrieved at all — context_precision and, through
# the context, faithfulness. Query-time: no re-ingest.
default_query_mode: str = "hybrid"
# RAGAS judge — an independent local model (different family from the LLM
# that built the graph) scores the eval. Runs on CPU (num_gpu=0) so it does
# not contend with the GPU-resident RAG model. gemma4:12b is too large for
# the 8GB GPU but fits comfortably in CPU RAM.
# #ADJUST judges: the single judge of `just eval` / `just eval-local`; the judge sets
# the absolute score level (see OKF/learnings/evaluation.md).
ragas_judge_model: str = "qwen2.5:7b"
model_config = {
"env_file": ".env",
"env_file_encoding": "utf-8",
"extra": "ignore",
}
settings = Settings()