File size: 860 Bytes
f8c4dcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
    
    @classmethod
    def setup_dirs(cls):
        """Ensure required directories exist"""
        cls.KNOWLEDGE_DIR.mkdir(exist_ok=True)
        cls.VECTOR_STORE_PATH.mkdir(exist_ok=True)