Spaces:
Sleeping
Sleeping
| # file: app/config.py | |
| import os | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| # Paths | |
| BASE_DIR = Path(__file__).parent.parent | |
| DATA_DIR = BASE_DIR / "data" | |
| # Hugging Face Inference API | |
| HF_API_TOKEN = os.getenv("HF_API_TOKEN", "") | |
| # LLM Configuration - Optimized for FREE HF CPU Inference | |
| # Primary: Qwen2.5-3B (3B params - 2.3x faster than 7B, better for CPU) | |
| # Alternative options for CPU: | |
| # - "Qwen/Qwen2.5-3B-Instruct" (3B - fast, high quality) | |
| # - "microsoft/Phi-3-mini-4k-instruct" (3.8B - ultra efficient) | |
| # - "HuggingFaceTB/SmolLM2-1.7B-Instruct" (1.7B - fastest) | |
| MODEL_NAME = os.getenv("MODEL_NAME", "Qwen/Qwen2.5-3B-Instruct") | |
| MODEL_NAME_FALLBACK = os.getenv("MODEL_NAME_FALLBACK", "microsoft/Phi-3-mini-4k-instruct") | |
| # Web Search Configuration | |
| # Set to "true" to skip web search and use fallback data (recommended for demo/rate-limited environments) | |
| SKIP_WEB_SEARCH = os.getenv("SKIP_WEB_SEARCH", "false").lower() == "true" | |
| # Vector Store | |
| VECTOR_INDEX_PATH = os.getenv("VECTOR_INDEX_PATH", str(DATA_DIR / "faiss.index")) | |
| EMBEDDING_MODEL = "sentence-transformers/all-MiniLM-L6-v2" | |
| EMBEDDING_DIM = 384 | |
| # MCP Servers | |
| MCP_SEARCH_PORT = int(os.getenv("MCP_SEARCH_PORT", "9001")) | |
| MCP_EMAIL_PORT = int(os.getenv("MCP_EMAIL_PORT", "9002")) | |
| MCP_CALENDAR_PORT = int(os.getenv("MCP_CALENDAR_PORT", "9003")) | |
| MCP_STORE_PORT = int(os.getenv("MCP_STORE_PORT", "9004")) | |
| # Compliance | |
| COMPANY_FOOTER_PATH = os.getenv("COMPANY_FOOTER_PATH", str(DATA_DIR / "footer.txt")) | |
| ENABLE_CAN_SPAM = os.getenv("ENABLE_CAN_SPAM", "true").lower() == "true" | |
| ENABLE_PECR = os.getenv("ENABLE_PECR", "true").lower() == "true" | |
| ENABLE_CASL = os.getenv("ENABLE_CASL", "true").lower() == "true" | |
| # Scoring | |
| MIN_FIT_SCORE = float(os.getenv("MIN_FIT_SCORE", "0.5")) | |
| FACT_TTL_HOURS = int(os.getenv("FACT_TTL_HOURS", "168")) # 1 week | |
| # Data Files | |
| COMPANIES_FILE = DATA_DIR / "companies.json" | |
| SUPPRESSION_FILE = DATA_DIR / "suppression.json" | |