mindnet/app/config.py
Lars 52d5d01337
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 2s
app/config.py aktualisiert
2025-10-07 10:50:36 +02:00

38 lines
1.5 KiB
Python

"""
app/config.py — zentrale Konfiguration (ENV → Settings)
Version:
0.2.0 (WP-04: Retriever-Gewichte & Defaults ergänzt; keine Verhaltensänderung für bestehende Nutzung)
Stand:
2025-10-06
Hinweis:
Bestehende Attribute bleiben erhalten; neue WP-04 Felder sind optional.
"""
from __future__ import annotations
import os
from functools import lru_cache
class Settings:
# Qdrant
QDRANT_URL: str = os.getenv("QDRANT_URL", "http://127.0.0.1:6333")
QDRANT_API_KEY: str | None = os.getenv("QDRANT_API_KEY")
COLLECTION_PREFIX: str = os.getenv("MINDNET_PREFIX", "mindnet")
VECTOR_SIZE: int = int(os.getenv("MINDNET_VECTOR_SIZE", "384"))
DISTANCE: str = os.getenv("MINDNET_DISTANCE", "Cosine")
# Embeddings
MODEL_NAME: str = os.getenv("MINDNET_MODEL", "sentence-transformers/all-MiniLM-L6-v2")
# API
DEBUG: bool = os.getenv("DEBUG", "false").lower() == "true"
# WP-04 Retriever Defaults (optional; können per ENV überschrieben werden)
RETRIEVER_W_SEM: float = float(os.getenv("MINDNET_WP04_W_SEM", "0.70"))
RETRIEVER_W_EDGE: float = float(os.getenv("MINDNET_WP04_W_EDGE", "0.25"))
RETRIEVER_W_CENT: float = float(os.getenv("MINDNET_WP04_W_CENT", "0.05"))
RETRIEVER_TOP_K: int = int(os.getenv("MINDNET_WP04_TOP_K", "10"))
RETRIEVER_EXPAND_DEPTH: int = int(os.getenv("MINDNET_WP04_EXPAND_DEPTH", "1"))
RETRIEVER_EDGE_TYPES: str = os.getenv("MINDNET_WP04_EDGE_TYPES", "references,belongs_to,prev,next")
@lru_cache
def get_settings() -> Settings:
return Settings()