Spaces:
Paused
Paused
| # File 3: config.py | |
| with open(f"{base_dir}/config.py", "w") as f: | |
| f.write('''"""Swarm CLI Configuration""" | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| class Config: | |
| """Central configuration for Swarm CLI""" | |
| # API Keys | |
| GROQ_API_KEY = os.getenv("GROQ_API_KEY", "") | |
| GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "") | |
| # Model Configuration | |
| GROQ_MODEL = "llama-3.3-70b-versatile" | |
| GROQ_FAST_MODEL = "llama-3.1-8b-instant" | |
| GEMINI_MODEL = "gemini-1.5-flash" | |
| GEMINI_PRO_MODEL = "gemini-1.5-pro" | |
| # Agent Settings | |
| MAX_ITERATIONS = int(os.getenv("MAX_ITERATIONS", "10")) | |
| DEBUG_MODE = os.getenv("DEBUG_MODE", "false").lower() == "true" | |
| # Paths | |
| SANDBOX_PATH = os.getenv("SANDBOX_PATH", "./sandbox") | |
| MEMORY_FILE = "./memory.json" | |
| LOG_FILE = "./swarm.log" | |
| # Rate Limits | |
| GROQ_MAX_TOKENS = 4096 | |
| GEMINI_MAX_TOKENS = 8192 | |
| @classmethod | |
| def validate(cls): | |
| """Validate required configuration""" | |
| if not cls.GROQ_API_KEY or cls.GROQ_API_KEY == "gsk_your_groq_key_here": | |
| raise ValueError("GROQ_API_KEY not set. Please set it in .env file") | |
| if not cls.GEMINI_API_KEY or cls.GEMINI_API_KEY == "AIzaSyYourGeminiKeyHere": | |
| raise ValueError("GEMINI_API_KEY not set. Please set it in .env file") | |
| return True | |
| @classmethod | |
| def ensure_sandbox(cls): | |
| """Ensure sandbox directory exists""" | |
| os.makedirs(cls.SANDBOX_PATH, exist_ok=True) | |
| return cls.SANDBOX_PATH | |
| ''') | |
| print("config.py done") |