BuddAI/skills/system_info.py
JamesTheGiblet f9fd27d228 Implement core skills: Code validation, model fine-tuning, and system diagnostics
- Added `ModelFineTuner` class for preparing training data and fine-tuning models based on user corrections.
- Introduced `CodeValidator` class to validate generated code against various hardware and style rules, including safety checks and function naming conventions.
- Developed skills for calculator operations, system information retrieval, weather fetching, and timer functionality.
- Implemented a self-diagnostic skill to run unit tests and report results.
- Created a dynamic skill loading mechanism to discover and register skills from the current directory.
- Added unit tests for skills to ensure functionality and reliability.
2026-01-06 22:04:37 +00:00

27 lines
No EOL
812 B
Python

import psutil
def meta():
"""
Metadata for the System Info skill.
"""
return {
"name": "System Info",
"description": "Reports current CPU and RAM usage.",
"triggers": ["cpu usage", "ram usage", "memory usage", "system stats", "how much ram", "cpu load"]
}
def run(payload):
"""
Fetches system metrics.
"""
# interval=0.1 ensures we get a fresh sample (blocking briefly)
cpu_usage = psutil.cpu_percent(interval=0.1)
mem = psutil.virtual_memory()
total_gb = mem.total / (1024 ** 3)
used_gb = mem.used / (1024 ** 3)
percent_used = mem.percent
return (f"🖥️ System Vital Signs:\n"
f" 🧠 CPU Load: {cpu_usage}%\n"
f" 💾 RAM Usage: {percent_used}% ({used_gb:.1f}GB / {total_gb:.1f}GB)")