Spaces:
Sleeping
Sleeping
| from pathlib import Path | |
| class Config: | |
| """Configuration class for all system settings""" | |
| # File paths | |
| KNOWLEDGE_DIR = Path("knowledge_base") # Directory for all knowledge files | |
| VECTOR_STORE_PATH = Path("vector_store") # Directory for FAISS index | |
| BM25_STORE_PATH = Path("vector_store/bm25.pkl") # Serialized BM25 retriever | |
| # Text processing | |
| CHUNK_SIZE = 1000 # Optimal for balance between context and retrieval | |
| CHUNK_OVERLAP = 200 | |
| MAX_CONTEXT_CHUNKS = 5 # Number of chunks to retrieve | |
| # Performance | |
| CACHE_EXPIRY_HOURS = 24 | |
| RELEVANCE_THRESHOLD = 0.72 # Strict similarity threshold | |
| def setup_dirs(cls): | |
| """Ensure required directories exist""" | |
| cls.KNOWLEDGE_DIR.mkdir(exist_ok=True) | |
| cls.VECTOR_STORE_PATH.mkdir(exist_ok=True) | |