FerrellSyntheticIntelligence's picture
Upload folder using huggingface_hub
d2a5f5a verified
Raw
History Blame Contribute Delete
826 Bytes
"""
Error Learning Loop — Vitalis FSI
Tracks failures, extracts patterns, feeds corrections back into reasoning.
"""
import time
class ErrorLearningLoop:
def __init__(self):
self._errors = []
self._corrections = {}
def record(self, task: str, error: str):
self._errors.append({
"task": task, "error": error, "t": time.time()})
key = error[:40]
self._corrections[key] = self._corrections.get(key, 0) + 1
def most_common(self) -> list:
return sorted(self._corrections.items(),
key=lambda x: x[1], reverse=True)[:5]
def report(self) -> dict:
return {
"total_errors": len(self._errors),
"unique_patterns": len(self._corrections),
"most_common": self.most_common(),
}