-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_loop.py
More file actions
61 lines (47 loc) · 1.66 KB
/
demo_loop.py
File metadata and controls
61 lines (47 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
RMA-Kernel: Simulation Loop
Run this script to observe the Supervisor Logic in action.
Usage:
python examples/demo_loop.py
"""
import sys
import os
# Add project root to python path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from src.supervisor import Supervisor
from src.verifier import Verifier, CosineDriftMetric
from src.uncertainty import UncertaintyScorer
from src.generator import DummyGenerator
from src.embedding import DummyEmbeddingProvider
def main():
print("🚀 RMA-Kernel: System 2 Inference Loop Initialized")
print("---------------------------------------------------")
# 1. Setup Components (Using Dummy for instant run without keys)
generator = DummyGenerator()
embedder = DummyEmbeddingProvider()
scorer = UncertaintyScorer(max_uncertainty=0.4)
drift_metric = CosineDriftMetric()
verifier = Verifier(
uncertainty_scorer=scorer,
drift_metric=drift_metric,
drift_threshold=0.4
)
supervisor = Supervisor(max_iterations=5)
# 2. Run Loop
query = "What is the ultimate answer?"
print(f"\nUSER QUERY: '{query}'")
print("---------------------------------------------------")
try:
final_result = supervisor.run(
query=query,
generator=generator,
verifier=verifier,
embedder=embedder
)
print("\n✅ FINAL OUTPUT RELEASED:")
print(f" {final_result['output']}")
print(f" (Uncertainty: {final_result.get('uncertainty', 0.0)})")
except Exception as e:
print(f"\n❌ PROCESS TERMINATED: {e}")
if __name__ == "__main__":
main()