CoolFace
Apppublic

Vineshnayak/CodeSage

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
config.py54 linesDownload Raw Back to root
1"""2Semantic Insight — Configuration3Central configuration for all modules.4"""5import os6from pathlib import Path7from dotenv import load_dotenv8 9load_dotenv(override=True)10 11# ── Paths ──────────────────────────────────────────────────────────────────12BASE_DIR = Path(__file__).parent13DATA_DIR = BASE_DIR / "data"14INDEX_DIR = DATA_DIR / "index"15GRAPH_DIR = DATA_DIR / "graph"16 17# Ensure data directories exist (critical for Hugging Face Spaces)18INDEX_DIR.mkdir(parents=True, exist_ok=True)19GRAPH_DIR.mkdir(parents=True, exist_ok=True)20 21# ── LLM Configuration ─────────────────────────────────────────────────────22GROQ_API_KEY = os.getenv("GROQ_API_KEY", "")23LLM_MODEL = os.getenv("LLM_MODEL", "llama-3.1-8b-instant")24EMBEDDING_MODEL = os.getenv("EMBEDDING_MODEL", "all-MiniLM-L6-v2")25 26USE_LOCAL_EMBEDDINGS = True27USE_GROQ_LLM = True28 29# ── Parser Configuration ──────────────────────────────────────────────────30SUPPORTED_EXTENSIONS = {".py"}31IGNORE_DIRS = {32    "__pycache__", ".git", ".venv", "venv", "env",33    "node_modules", ".tox", ".mypy_cache", ".pytest_cache",34    "dist", "build", "egg-info", ".eggs", ".idea", ".vscode",35}36MAX_FILE_SIZE_KB = 500  # Skip files larger than this37 38# ── Embedding Configuration ───────────────────────────────────────────────39EMBEDDING_DIMENSION = 384  # For all-MiniLM-L6-v240CHUNK_MAX_TOKENS = 51241CHUNK_OVERLAP_TOKENS = 6442 43# ── Complexity Thresholds ─────────────────────────────────────────────────44COMPLEXITY_HIGH = 1545COMPLEXITY_MEDIUM = 1046MAX_FUNCTION_LINES = 5047MAX_PARAMS = 748MAX_NESTING_DEPTH = 449 50# ── Server ─────────────────────────────────────────────────────────────────51API_HOST = "0.0.0.0"52API_PORT = 800053STREAMLIT_PORT = 850154