mirror of
https://github.com/JamesTheGiblet/BuddAI.git
synced 2026-01-08 21:58:40 +00:00
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.
This commit is contained in:
parent
743f9f311d
commit
f9fd27d228
28 changed files with 2398 additions and 4077 deletions
|
|
@ -1,53 +0,0 @@
|
|||
import os
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
import queue
|
||||
import http.client
|
||||
|
||||
# Global Config
|
||||
DATA_DIR = Path(__file__).parent / "data"
|
||||
DB_PATH = DATA_DIR / "conversations.db"
|
||||
OLLAMA_HOST = os.getenv("OLLAMA_HOST", "127.0.0.1")
|
||||
OLLAMA_PORT = int(os.getenv("OLLAMA_PORT", "11434"))
|
||||
|
||||
# Shared Models
|
||||
MODELS = {
|
||||
"fast": "qwen2.5-coder:1.5b",
|
||||
"balanced": "qwen2.5-coder:3b"
|
||||
}
|
||||
|
||||
# Shared Connection Pool logic to avoid "port in use" or "too many connections" errors
|
||||
class OllamaConnectionPool:
|
||||
def __init__(self, host, port, max_size=10):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.pool = queue.Queue(maxsize=max_size)
|
||||
def get_connection(self):
|
||||
try: return self.pool.get_nowait()
|
||||
except: return http.client.HTTPConnection(self.host, self.port, timeout=90)
|
||||
def return_connection(self, conn):
|
||||
try: self.pool.put_nowait(conn)
|
||||
except: conn.close()
|
||||
|
||||
OLLAMA_POOL = OllamaConnectionPool(OLLAMA_HOST, OLLAMA_PORT)
|
||||
|
||||
# Server Availability Check
|
||||
try:
|
||||
import fastapi
|
||||
import uvicorn
|
||||
SERVER_AVAILABLE = True
|
||||
except ImportError:
|
||||
SERVER_AVAILABLE = False
|
||||
|
||||
# Shared Patterns
|
||||
COMPLEX_TRIGGERS = [
|
||||
"multiple modules", "integrate", "combine", "modular", "state machine", "safety", "failsafe", "logic", "protocol", "integration"
|
||||
]
|
||||
MODULE_PATTERNS = {
|
||||
"ble": ["ble", "bluetooth", "phone app", "remote"],
|
||||
"servo": ["servo", "flipper", "arm", "mg996", "sg90"],
|
||||
"motor": ["motor", "drive", "l298n", "movement", "wheels"],
|
||||
"safety": ["safety", "timeout", "failsafe", "emergency"],
|
||||
"battery": ["battery", "voltage", "power"],
|
||||
"sensor": ["sensor", "distance", "proximity", "ultrasonic", "ir"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue