Spaces:
Sleeping
Sleeping
Download config.py from Vineshnayak/CodeSage: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/spaces/Vineshnayak/CodeSage/resolve/main/config.py
- Command line
-
hf download hf://spaces/Vineshnayak/CodeSage/config.py
-
curl -L -o config.py https://huggingface.co/spaces/Vineshnayak/CodeSage/resolve/main/config.py
2.37 kB
| """ | |
| Semantic Insight β Configuration | |
| Central configuration for all modules. | |
| """ | |
| import os | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| load_dotenv(override=True) | |
| # ββ Paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| BASE_DIR = Path(__file__).parent | |
| DATA_DIR = BASE_DIR / "data" | |
| INDEX_DIR = DATA_DIR / "index" | |
| GRAPH_DIR = DATA_DIR / "graph" | |
| # Ensure data directories exist (critical for Hugging Face Spaces) | |
| INDEX_DIR.mkdir(parents=True, exist_ok=True) | |
| GRAPH_DIR.mkdir(parents=True, exist_ok=True) | |
| # ββ LLM Configuration βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| GROQ_API_KEY = os.getenv("GROQ_API_KEY", "") | |
| LLM_MODEL = os.getenv("LLM_MODEL", "llama-3.1-8b-instant") | |
| EMBEDDING_MODEL = os.getenv("EMBEDDING_MODEL", "all-MiniLM-L6-v2") | |
| USE_LOCAL_EMBEDDINGS = True | |
| USE_GROQ_LLM = True | |
| # ββ Parser Configuration ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| SUPPORTED_EXTENSIONS = {".py"} | |
| IGNORE_DIRS = { | |
| "__pycache__", ".git", ".venv", "venv", "env", | |
| "node_modules", ".tox", ".mypy_cache", ".pytest_cache", | |
| "dist", "build", "egg-info", ".eggs", ".idea", ".vscode", | |
| } | |
| MAX_FILE_SIZE_KB = 500 # Skip files larger than this | |
| # ββ Embedding Configuration βββββββββββββββββββββββββββββββββββββββββββββββ | |
| EMBEDDING_DIMENSION = 384 # For all-MiniLM-L6-v2 | |
| CHUNK_MAX_TOKENS = 512 | |
| CHUNK_OVERLAP_TOKENS = 64 | |
| # ββ Complexity Thresholds βββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COMPLEXITY_HIGH = 15 | |
| COMPLEXITY_MEDIUM = 10 | |
| MAX_FUNCTION_LINES = 50 | |
| MAX_PARAMS = 7 | |
| MAX_NESTING_DEPTH = 4 | |
| # ββ Server βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| API_HOST = "0.0.0.0" | |
| API_PORT = 8000 | |
| STREAMLIT_PORT = 8501 | |