Mayank2027 commited on
Commit
b4cd3fc
·
verified ·
1 Parent(s): 7d614c6

Create config.py

Browse files
Files changed (1) hide show
  1. config.py +51 -0
config.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # File 3: config.py
2
+ with open(f"{base_dir}/config.py", "w") as f:
3
+ f.write('''"""Swarm CLI Configuration"""
4
+ import os
5
+ from dotenv import load_dotenv
6
+
7
+ load_dotenv()
8
+
9
+ class Config:
10
+ """Central configuration for Swarm CLI"""
11
+
12
+ # API Keys
13
+ GROQ_API_KEY = os.getenv("GROQ_API_KEY", "")
14
+ GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "")
15
+
16
+ # Model Configuration
17
+ GROQ_MODEL = "llama-3.3-70b-versatile"
18
+ GROQ_FAST_MODEL = "llama-3.1-8b-instant"
19
+ GEMINI_MODEL = "gemini-1.5-flash"
20
+ GEMINI_PRO_MODEL = "gemini-1.5-pro"
21
+
22
+ # Agent Settings
23
+ MAX_ITERATIONS = int(os.getenv("MAX_ITERATIONS", "10"))
24
+ DEBUG_MODE = os.getenv("DEBUG_MODE", "false").lower() == "true"
25
+
26
+ # Paths
27
+ SANDBOX_PATH = os.getenv("SANDBOX_PATH", "./sandbox")
28
+ MEMORY_FILE = "./memory.json"
29
+ LOG_FILE = "./swarm.log"
30
+
31
+ # Rate Limits
32
+ GROQ_MAX_TOKENS = 4096
33
+ GEMINI_MAX_TOKENS = 8192
34
+
35
+ @classmethod
36
+ def validate(cls):
37
+ """Validate required configuration"""
38
+ if not cls.GROQ_API_KEY or cls.GROQ_API_KEY == "gsk_your_groq_key_here":
39
+ raise ValueError("GROQ_API_KEY not set. Please set it in .env file")
40
+ if not cls.GEMINI_API_KEY or cls.GEMINI_API_KEY == "AIzaSyYourGeminiKeyHere":
41
+ raise ValueError("GEMINI_API_KEY not set. Please set it in .env file")
42
+ return True
43
+
44
+ @classmethod
45
+ def ensure_sandbox(cls):
46
+ """Ensure sandbox directory exists"""
47
+ os.makedirs(cls.SANDBOX_PATH, exist_ok=True)
48
+ return cls.SANDBOX_PATH
49
+ ''')
50
+
51
+ print("config.py done")