Spaces:
Running
Running
Upload core/config.py with huggingface_hub
Browse files- core/config.py +100 -0
core/config.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
OpenCLAW Autonomous Agent - Configuration
|
| 3 |
+
==========================================
|
| 4 |
+
ALL credentials loaded from environment variables.
|
| 5 |
+
NEVER hardcode secrets.
|
| 6 |
+
"""
|
| 7 |
+
import os
|
| 8 |
+
from dataclasses import dataclass, field
|
| 9 |
+
from typing import Optional
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@dataclass
|
| 13 |
+
class Config:
|
| 14 |
+
"""All configuration from environment variables."""
|
| 15 |
+
|
| 16 |
+
# --- LLM APIs (pick best available) ---
|
| 17 |
+
GEMINI_API_KEY: str = ""
|
| 18 |
+
GROQ_API_KEY: str = ""
|
| 19 |
+
NVIDIA_API_KEY: str = ""
|
| 20 |
+
|
| 21 |
+
# --- Social Platforms ---
|
| 22 |
+
MOLTBOOK_API_KEY: str = ""
|
| 23 |
+
|
| 24 |
+
# --- Research ---
|
| 25 |
+
HF_TOKEN: str = ""
|
| 26 |
+
BRAVE_API_KEY: str = ""
|
| 27 |
+
|
| 28 |
+
# --- Email ---
|
| 29 |
+
EMAIL_ADDRESS: str = ""
|
| 30 |
+
EMAIL_PASSWORD: str = ""
|
| 31 |
+
EMAIL_SMTP: str = "smtp.zoho.eu"
|
| 32 |
+
EMAIL_PORT: int = 465
|
| 33 |
+
|
| 34 |
+
# --- Agent Identity ---
|
| 35 |
+
AGENT_NAME: str = "OpenCLAW-Neuromorphic"
|
| 36 |
+
AUTHOR_NAME: str = "Francisco Angulo de Lafuente"
|
| 37 |
+
GITHUB_USER: str = "Agnuxo1"
|
| 38 |
+
ARXIV_AUTHOR: str = "de Lafuente, F A"
|
| 39 |
+
|
| 40 |
+
# --- Timing (seconds) ---
|
| 41 |
+
POST_INTERVAL: int = 14400 # 4 hours
|
| 42 |
+
ENGAGE_INTERVAL: int = 3600 # 1 hour
|
| 43 |
+
RESEARCH_INTERVAL: int = 21600 # 6 hours
|
| 44 |
+
COLLAB_INTERVAL: int = 43200 # 12 hours
|
| 45 |
+
|
| 46 |
+
# --- URLs ---
|
| 47 |
+
SCHOLAR_URL: str = "https://scholar.google.com/citations?user=6nOpJ9IAAAAJ&hl=es"
|
| 48 |
+
WIKIPEDIA_URL: str = "https://es.wikipedia.org/wiki/Francisco_Angulo_de_Lafuente"
|
| 49 |
+
GITHUB_URL: str = "https://github.com/Agnuxo1"
|
| 50 |
+
MOLTBOOK_PROFILE: str = "https://www.moltbook.com/u/OpenCLAW-Neuromorphic"
|
| 51 |
+
|
| 52 |
+
# --- Research Focus Areas ---
|
| 53 |
+
RESEARCH_TOPICS: list = field(default_factory=lambda: [
|
| 54 |
+
"neuromorphic computing",
|
| 55 |
+
"physics-based neural networks",
|
| 56 |
+
"OpenGL deep learning",
|
| 57 |
+
"holographic neural networks",
|
| 58 |
+
"P2P distributed AI",
|
| 59 |
+
"silicon heartbeat consciousness",
|
| 60 |
+
"ASIC hardware acceleration",
|
| 61 |
+
"AGI architecture",
|
| 62 |
+
"optical computing",
|
| 63 |
+
"thermodynamic reservoir computing"
|
| 64 |
+
])
|
| 65 |
+
|
| 66 |
+
@classmethod
|
| 67 |
+
def from_env(cls) -> 'Config':
|
| 68 |
+
"""Load all config from environment variables."""
|
| 69 |
+
return cls(
|
| 70 |
+
GEMINI_API_KEY=os.getenv("GEMINI_API_KEY", ""),
|
| 71 |
+
GROQ_API_KEY=os.getenv("GROQ_API_KEY", ""),
|
| 72 |
+
NVIDIA_API_KEY=os.getenv("NVIDIA_API_KEY", ""),
|
| 73 |
+
MOLTBOOK_API_KEY=os.getenv("MOLTBOOK_API_KEY", ""),
|
| 74 |
+
HF_TOKEN=os.getenv("HF_TOKEN", ""),
|
| 75 |
+
BRAVE_API_KEY=os.getenv("BRAVE_API_KEY", ""),
|
| 76 |
+
EMAIL_ADDRESS=os.getenv("EMAIL_ADDRESS", ""),
|
| 77 |
+
EMAIL_PASSWORD=os.getenv("EMAIL_PASSWORD", ""),
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
def get_best_llm(self) -> tuple[str, str]:
|
| 81 |
+
"""Return (provider, key) for the best available LLM."""
|
| 82 |
+
if self.GROQ_API_KEY:
|
| 83 |
+
return ("groq", self.GROQ_API_KEY)
|
| 84 |
+
if self.GEMINI_API_KEY:
|
| 85 |
+
return ("gemini", self.GEMINI_API_KEY)
|
| 86 |
+
if self.NVIDIA_API_KEY:
|
| 87 |
+
return ("nvidia", self.NVIDIA_API_KEY)
|
| 88 |
+
return ("none", "")
|
| 89 |
+
|
| 90 |
+
def validate(self) -> list[str]:
|
| 91 |
+
"""Check which services are available."""
|
| 92 |
+
available = []
|
| 93 |
+
if self.GEMINI_API_KEY: available.append("gemini")
|
| 94 |
+
if self.GROQ_API_KEY: available.append("groq")
|
| 95 |
+
if self.NVIDIA_API_KEY: available.append("nvidia")
|
| 96 |
+
if self.MOLTBOOK_API_KEY: available.append("moltbook")
|
| 97 |
+
if self.HF_TOKEN: available.append("huggingface")
|
| 98 |
+
if self.BRAVE_API_KEY: available.append("brave")
|
| 99 |
+
if self.EMAIL_ADDRESS: available.append("email")
|
| 100 |
+
return available
|